exit; } switch ($_REQUEST['action']) { case 'sync': if (!Access::check('interface', '75')) { debug_event('DENIED', $GLOBALS['user']->username . ' attempted to sync podcast', 1); exit; } if (isset($_REQUEST['podcast_id'])) { $podcast = new Podcast($_REQUEST['podcast_id']); if ($podcast->id) { $podcast->sync_episodes(true); } else { debug_event('podcast', 'Cannot found podcast', 1); } } elseif (isset($_REQUEST['podcast_episode_id'])) { $episode = new Podcast_Episode($_REQUEST['podcast_episode_id']); if ($episode->id) { $episode->gather(); } else { debug_event('podcast', 'Cannot found podcast episode', 1); } } $results['rfc3514'] = '0x1'; break; default: $results['rfc3514'] = '0x1'; break; } // We always do this echo xoutput_from_array($results);
/** * downloadPodcastEpisode * Request the server to download a podcast episode * Takes the podcast episode id in parameter. */ public static function downloadpodcastepisode($input) { self::check_version($input, "1.9.0"); $id = self::check_parameter($input, 'id'); if (AmpConfig::get('podcast') && Access::check('interface', 75)) { $episode = new Podcast_Episode(Subsonic_XML_Data::getAmpacheId($id)); if ($episode->id) { $episode->gather(); $r = Subsonic_XML_Data::createSuccessResponse(); } else { $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND); } } else { $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED); } self::apiOutput($input, $r); }
public function remove() { $episodes = $this->get_episodes(); foreach ($episodes as $episode_id) { $episode = new Podcast_Episode($episode_id); $episode->remove(); } $sql = "DELETE FROM `podcast` WHERE `id` = ?"; return Dba::write($sql, array($this->id)); }
/** * set_played * this checks to see if the current object has been played * if not then it sets it to played. In any case it updates stats. * @param int $user * @param string $agent * @param array $location * @return boolean */ public function set_played($user, $agent, $location) { Stats::insert('podcast', $this->podcast, $user, $agent, $location); Stats::insert('podcast_episode', $this->id, $user, $agent, $location); if ($this->played) { return true; } /* If it hasn't been played, set it! */ Podcast_Episode::update_played(true, $this->id); return true; }
$_SESSION['random']['last'] = $oid; } } else { $oid = $_SESSION['random']['last']; } } // if random if ($type == 'song') { /* Base Checks passed create the song object */ $media = new Song($oid); $media->format(); } elseif ($type == 'song_preview') { $media = new Song_Preview($oid); $media->format(); } elseif ($type == 'podcast_episode') { $media = new Podcast_Episode($oid); $media->format(); } else { $type = 'video'; $media = new Video($oid); if (isset($_REQUEST['subtitle'])) { $subtitle = $media->get_subtitle_file($_REQUEST['subtitle']); } $media->format(); } if (!User::stream_control(array(array('object_type' => $type, 'object_id' => $media->id)))) { debug_event('UI::access_denied', 'Stream control failed for user ' . $GLOBALS['user']->username . ' on ' . $media->get_stream_name(), 3); UI::access_denied(); exit; } if ($media->catalog) {
if (AmpConfig::get('share')) { ?> <?php Share::display_ui('podcast_episode', $episode->id, false); ?> <?php } ?> <?php } ?> <?php if (Access::check_function('download') && !empty($episode->file)) { ?> <a rel="nohtml" href="<?php echo Podcast_Episode::play_url($episode->id); ?> "><?php echo UI::get_icon('link', T_('Link')); ?> </a> <a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?> /stream.php?action=download&podcast_episode_id=<?php echo $episode->id; ?> "><?php echo UI::get_icon('download', T_('Download')); ?> </a>
case 'delete': if (AmpConfig::get('demo_mode')) { break; } $episode_id = scrub_in($_REQUEST['podcast_episode_id']); show_confirmation(T_('Podcast Episode Deletion'), T_('Are you sure you want to permanently delete this episode?'), AmpConfig::get('web_path') . "/podcast_episode.php?action=confirm_delete&podcast_episode_id=" . $episode_id, 1, 'delete_podcast_episode'); break; case 'confirm_delete': if (AmpConfig::get('demo_mode')) { break; } $episode = new Podcast_Episode($_REQUEST['podcast_episode_id']); if (!Catalog::can_remove($episode)) { debug_event('video', 'Unauthorized to remove the episode `.' . $episode->id . '`.', 1); UI::access_denied(); exit; } if ($episode->remove()) { show_confirmation(T_('Podcast Episode Deletion'), T_('Episode has been deleted.'), AmpConfig::get('web_path')); } else { show_confirmation(T_('Podcast Episode Deletion'), T_('Cannot delete this episode.'), AmpConfig::get('web_path')); } break; case 'show': default: $episode = new Podcast_Episode($_REQUEST['podcast_episode']); $episode->format(); require_once AmpConfig::get('prefix') . UI::find_template('show_podcast_episode.inc.php'); break; } UI::show_footer();
private static function _itemPodcastEpisode($episode, $parent) { $api_session = AmpConfig::get('require_session') ? Stream::get_session() : false; $art_url = Art::url($episode->podcast, 'podcast', $api_session); $fileTypesByExt = self::_getFileTypes(); $arrFileType = !empty($episode->type) ? $fileTypesByExt[$episode->type] : array(); $ret = array('id' => 'amp://music/podcasts/' . $episode->podcast . '/' . $episode->id, 'parentID' => $parent, 'restricted' => '1', 'dc:title' => self::_replaceSpecialSymbols($episode->f_title), 'upnp:album' => self::_replaceSpecialSymbols($episode->f_podcast), 'upnp:class' => isset($arrFileType['class']) ? $arrFileType['class'] : 'object.item.unknownItem', 'upnp:albumArtURI' => $art_url); if (isset($arrFileType['mime'])) { $ret['res'] = Podcast_Episode::play_url($episode->id, '', 'api'); $ret['protocolInfo'] = $arrFileType['mime']; $ret['size'] = $episode->size; $ret['duration'] = $episode->f_time_h . '.0'; } return $ret; }
<th class="cel_action essential"><?php echo T_('Actions'); ?> </th> </tr> </thead> <tbody> <?php if (AmpConfig::get('ratings')) { Rating::build_cache('podcast_episode', $object_ids); } if (AmpConfig::get('userflags')) { Userflag::build_cache('podcast_episode', $object_ids); } foreach ($object_ids as $episode_id) { $libitem = new Podcast_Episode($episode_id); $libitem->format(); ?> <tr id="podcast_episode_<?php echo $libitem->id; ?> " class="<?php echo UI::flip_class(); ?> "> <?php require AmpConfig::get('prefix') . UI::find_template('show_podcast_episode_row.inc.php'); ?> </tr> <?php }