Esempio n. 1
0
     $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']);
     foreach ($albums_array as $a) {
         $album = new Album($a);
         $songs = $album->get_songs();
         foreach ($songs as $song) {
             $media_ids[] = array('object_type' => 'song', 'object_id' => $song);
         }
     }
     break;
 case 'playlist':
     $playlist = new Playlist($_REQUEST['playlist_id']);
     $songs = $playlist->get_songs();
     foreach ($songs as $song) {
         $media_ids[] = array('object_type' => 'song', 'object_id' => $song);
     }
     break;
 case 'smartplaylist':
     $playlist = new Search('song', $_REQUEST['playlist_id']);
     $items = $playlist->get_items();
     foreach ($items as $item) {
         $media_ids[] = array('object_type' => $item['object_type'], 'object_id' => $item['object_id']);
     }
     break;
 case 'playlist_random':
     $playlist = new Playlist($_REQUEST['playlist_id']);
     $media_ids = $playlist->get_random_items();
     break;
Esempio n. 2
0
 public static function addShare($xml, $share)
 {
     $xshare = $xml->addChild('share');
     $xshare->addAttribute('id', $share->id);
     $xshare->addAttribute('url', $share->public_url);
     $xshare->addAttribute('description', $share->description);
     $user = new User($share->user);
     $xshare->addAttribute('username', $user->username);
     $xshare->addAttribute('created', date("c", $share->creation_date));
     if ($share->lastvisit_date > 0) {
         $xshare->addAttribute('lastVisited', date("c", $share->lastvisit_date));
     }
     if ($share->expire_days > 0) {
         $xshare->addAttribute('expires', date("c", $share->creation_date + $share->expire_days * 86400));
     }
     $xshare->addAttribute('visitCount', $share->counter);
     if ($share->object_type == 'song') {
         $song = new Song($share->object_id);
         self::addSong($xshare, $song, "entry");
     } elseif ($share->object_type == 'playlist') {
         $playlist = new Playlist($share->object_id);
         $songs = $playlist->get_songs();
         foreach ($songs as $id) {
             $song = new Song($id);
             self::addSong($xshare, $song, "entry");
         }
     } elseif ($share->object_type == 'album') {
         $album = new Album($share->object_id);
         $songs = $album->get_songs();
         foreach ($songs as $id) {
             $song = new Song($id);
             self::addSong($xshare, $song, "entry");
         }
     }
 }
Esempio n. 3
0
             }
         }
         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);
             if ($type == 'song') {
                 $songs[] = array_shift($object_data);
             }
         }
         break;
 }
 if (count($songs) > 0) {
     Ajax::set_include_override(true);
     $playlist->add_songs($songs, true);
Esempio n. 4
0
if (!defined('NO_SESSION') && !Access::check_function('batch_download')) {
    UI::access_denied();
    exit;
}
/* Drop the normal Time limit constraints, this can take a while */
set_time_limit(0);
$media_ids = array();
$name = "Unknown.zip";
switch ($_REQUEST['action']) {
    case 'tmp_playlist':
        $media_ids = $GLOBALS['user']->playlist->get_items();
        $name = $GLOBALS['user']->username . ' - Playlist';
        break;
    case 'playlist':
        $playlist = new Playlist($_REQUEST['id']);
        $media_ids = $playlist->get_songs();
        $name = $playlist->name;
        break;
    case 'smartplaylist':
        $search = new Search('song', $_REQUEST['id']);
        $sql = $search->to_sql();
        $sql = $sql['base'] . ' ' . $sql['table_sql'] . ' WHERE ' . $sql['where_sql'];
        $db_results = Dba::read($sql);
        while ($row = Dba::fetch_assoc($db_results)) {
            $media_ids[] = $row['id'];
        }
        $name = $search->name;
        break;
    case 'album':
        foreach ($_REQUEST['id'] as $a) {
            $album = new Album($a);