当前位置: 首页>>代码示例>>PHP>>正文


PHP Artist::get_songs方法代码示例

本文整理汇总了PHP中Artist::get_songs方法的典型用法代码示例。如果您正苦于以下问题:PHP Artist::get_songs方法的具体用法?PHP Artist::get_songs怎么用?PHP Artist::get_songs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Artist的用法示例。


在下文中一共展示了Artist::get_songs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update_single_item

 /**
  * update_single_item
  * updates a single album,artist,song from the tag data
  * this can be done by 75+
  */
 public static function update_single_item($type, $id)
 {
     // Because single items are large numbers of things too
     set_time_limit(0);
     $songs = array();
     switch ($type) {
         case 'album':
             $album = new Album($id);
             $songs = $album->get_songs();
             break;
         case 'artist':
             $artist = new Artist($id);
             $songs = $artist->get_songs();
             break;
         case 'song':
             $songs[] = $id;
             break;
     }
     // end switch type
     foreach ($songs as $song_id) {
         $song = new Song($song_id);
         $info = self::update_media_from_tags($song, '', '');
         if ($info['change']) {
             $file = scrub_out($song->file);
             echo "<dl>\n\t<dd>";
             echo "<strong>{$file} " . T_('Updated') . "</strong>\n";
             echo $info['text'];
             echo "\t</dd>\n</dl><hr align=\"left\" width=\"50%\" />";
             flush();
         } else {
             echo "<dl>\n\t<dd>";
             echo "<strong>" . scrub_out($song->file) . "</strong><br />" . T_('No Update Needed') . "\n";
             echo "\t</dd>\n</dl><hr align=\"left\" width=\"50%\" />";
             flush();
         }
     }
     // foreach songs
     self::gc();
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:44,代码来源:catalog.class.php

示例2: foreach

             foreach ($data as $value) {
                 $media_ids[] = $value->id;
             }
             break;
     }
     // end switch on type
     break;
 case 'single_song':
     $media_ids[] = array('object_type' => 'song', 'object_id' => scrub_in($_REQUEST['song_id']), 'custom_play_action' => $_REQUEST['custom_play_action']);
     break;
 case 'single_video':
     $media_ids[] = array('object_type' => 'video', 'object_id' => scrub_in($_REQUEST['video_id']));
     break;
 case 'artist':
     $artist = new Artist($_REQUEST['artist_id']);
     $songs = $artist->get_songs();
     foreach ($songs as $song) {
         $media_ids[] = array('object_type' => 'song', 'object_id' => $song);
     }
     break;
 case 'artist_random':
     $artist = new Artist($_REQUEST['artist_id']);
     $media_ids = $artist->get_random_songs();
     break;
 case 'album_random':
     $album = new Album($_REQUEST['album_id']);
     $media_ids = $album->get_random_songs();
     break;
 case 'album':
     debug_event('stream.php', 'Playing/Adding all songs of album(s) {' . $_REQUEST['album_id'] . '}...', '5');
     $albums_array = explode(',', $_REQUEST['album_id']);
开发者ID:axelsimon,项目名称:ampache,代码行数:31,代码来源:stream.php

示例3: artist_songs

 /**
  * artist_songs
  * This returns the songs of the specified artist
  */
 public static function artist_songs($input)
 {
     $artist = new Artist($input['filter']);
     $songs = $artist->get_songs();
     // Set the offset
     XML_Data::set_offset($input['offset']);
     XML_Data::set_limit($input['limit']);
     ob_end_clean();
     echo XML_Data::songs($songs);
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:14,代码来源:api.class.php

示例4: album

     break;
 case 'album':
     debug_event('playlist', 'Adding all songs of album(s) {' . $item_id . '}...', '5');
     $albums_array = explode(',', $item_id);
     foreach ($albums_array as $a) {
         $album = new Album($a);
         $asongs = $album->get_songs();
         foreach ($asongs as $song_id) {
             $songs[] = $song_id;
         }
     }
     break;
 case 'artist':
     debug_event('playlist', 'Adding all songs of artist {' . $item_id . '}...', '5');
     $artist = new Artist($item_id);
     $songs[] = $artist->get_songs();
     break;
 case 'song_preview':
 case 'song':
     debug_event('playlist', 'Adding song {' . $item_id . '}...', '5');
     $songs = explode(',', $item_id);
     break;
 case 'playlist':
     $pl = new Playlist($item_id);
     $songs = $pl->get_songs();
     break;
 default:
     debug_event('playlist', 'Adding all songs of current playlist...', '5');
     $objects = $GLOBALS['user']->playlist->get_items();
     foreach ($objects as $object_data) {
         $type = array_shift($object_data);
开发者ID:cheese1,项目名称:ampache,代码行数:31,代码来源:playlist.ajax.php

示例5: Artist

 case 'show':
     $artist = new Artist($_REQUEST['artist']);
     $artist->format();
     if (AmpConfig::get('album_release_type')) {
         $multi_object_ids = $artist->get_albums($_REQUEST['catalog'], false, true);
     } else {
         $object_ids = $artist->get_albums($_REQUEST['catalog']);
     }
     $object_type = 'album';
     require_once AmpConfig::get('prefix') . '/templates/show_artist.inc.php';
     break;
 case 'show_all_songs':
     $artist = new Artist($_REQUEST['artist']);
     $artist->format();
     $object_type = 'song';
     $object_ids = $artist->get_songs();
     require_once AmpConfig::get('prefix') . '/templates/show_artist.inc.php';
     break;
 case 'update_from_tags':
     $type = 'artist';
     $object_id = intval($_REQUEST['artist']);
     $target_url = AmpConfig::get('web_path') . "/artists.php?action=show&amp;artist=" . $object_id;
     require_once AmpConfig::get('prefix') . '/templates/show_update_items.inc.php';
     break;
 case 'match':
 case 'Match':
     $match = scrub_in($_REQUEST['match']);
     if ($match == "Browse" || $match == "Show_all") {
         $chr = "";
     } else {
         $chr = $match;
开发者ID:nioc,项目名称:ampache,代码行数:31,代码来源:artists.php

示例6: advanced


//.........这里部分代码省略.........
             $sql .= ' GROUP BY `album`.`id`';
             break;
         case 'artist':
             $sql = "SELECT `artist`.`id`, SUM(`song`.`size`) AS `size`, SUM(`song`.`time`) AS `time` FROM `artist` ";
             if (!$search_info || !$search_info['join']['song']) {
                 $sql .= "LEFT JOIN `song` ON `song`.`artist`=`artist`.`id` ";
             }
             if ($search_info) {
                 $sql .= $search_info['table_sql'];
             }
             if (AmpConfig::get('catalog_disable')) {
                 $sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
                 $sql .= " WHERE `catalog`.`enabled` = '1'";
             }
             if ($search_info) {
                 if (AmpConfig::get('catalog_disable')) {
                     $sql .= ' AND ' . $search_info['where_sql'];
                 } else {
                     $sql .= ' WHERE ' . $search_info['where_sql'];
                 }
             }
             $sql .= ' GROUP BY `artist`.`id`';
             break;
     }
     $sql .= " ORDER BY RAND() {$limit_sql}";
     // Run the query generated above so we can while it
     $db_results = Dba::read($sql);
     $results = array();
     $size_total = 0;
     $fuzzy_size = 0;
     $time_total = 0;
     $fuzzy_time = 0;
     while ($row = Dba::fetch_assoc($db_results)) {
         // If size limit is specified
         if ($data['size_limit']) {
             // Convert
             $new_size = $row['size'] / 1024 / 1024;
             // Only fuzzy 100 times
             if ($fuzzy_size > 100) {
                 break;
             }
             // Add and check, skip if over size
             if ($size_total + $new_size > $data['size_limit']) {
                 $fuzzy_size++;
                 continue;
             }
             $size_total = $size_total + $new_size;
             $results[] = $row['id'];
             // If we are within 4mb of target then jump ship
             if ($data['size_limit'] - floor($size_total) < 4) {
                 break;
             }
         }
         // if size_limit
         // If length really does matter
         if ($data['length']) {
             // base on min, seconds are for chumps and chumpettes
             $new_time = floor($row['time'] / 60);
             if ($fuzzy_time > 100) {
                 break;
             }
             // If the new one would go over skip!
             if ($time_total + $new_time > $data['length']) {
                 $fuzzy_time++;
                 continue;
             }
             $time_total = $time_total + $new_time;
             $results[] = $row['id'];
             // If there are less then 2 min of free space return
             if ($data['length'] - $time_total < 2) {
                 return $results;
             }
         }
         // if length does matter
         if (!$data['size_limit'] && !$data['length']) {
             $results[] = $row['id'];
         }
     }
     // end while results
     switch ($type) {
         case 'song':
             return $results;
         case 'album':
             $songs = array();
             foreach ($results as $result) {
                 $album = new Album($result);
                 $songs = array_merge($songs, $album->get_songs());
             }
             return $songs;
         case 'artist':
             $songs = array();
             foreach ($results as $result) {
                 $artist = new Artist($result);
                 $songs = array_merge($songs, $artist->get_songs());
             }
             return $songs;
         default:
             return false;
     }
 }
开发者ID:ivan801,项目名称:ampache,代码行数:101,代码来源:random.class.php

示例7: foreach

     break;
 case 'album':
     foreach ($_REQUEST['id'] as $a) {
         $album = new Album($a);
         if (empty($name)) {
             $name = $album->name;
         }
         $asongs = $album->get_songs();
         foreach ($asongs as $song_id) {
             $media_ids[] = $song_id;
         }
     }
     break;
 case 'artist':
     $artist = new Artist($_REQUEST['id']);
     $media_ids = $artist->get_songs();
     $name = $artist->name;
     break;
 case 'browse':
     $id = scrub_in($_REQUEST['browse_id']);
     $browse = new Browse($id);
     $browse_media_ids = $browse->get_saved();
     foreach ($browse_media_ids as $media_id) {
         switch ($_REQUEST['type']) {
             case 'album':
                 $album = new Album($media_id);
                 $media_ids = array_merge($media_ids, $album->get_songs());
                 break;
             case 'song':
                 $media_ids[] = $media_id;
                 break;
开发者ID:axelsimon,项目名称:ampache,代码行数:31,代码来源:batch.php


注:本文中的Artist::get_songs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。