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>
/** * stream * Streams a given media file. * Takes the file id in parameter with optional max bit rate, file format, time offset, size and estimate content length option. */ public static function stream($input) { self::check_version($input, "1.0.0", true); $fileid = self::check_parameter($input, 'id', true); $maxBitRate = $input['maxBitRate']; $format = $input['format']; // mp3, flv or raw $timeOffset = $input['timeOffset']; $size = $input['size']; // For video streaming. Not supported. $estimateContentLength = $input['estimateContentLength']; // Force content-length guessing if transcode $params = '&client=' . rawurlencode($input['c']) . '&noscrobble=1'; if ($estimateContentLength == 'true') { $params .= '&content_length=required'; } if ($format && $format != "raw") { $params .= '&transcode_to=' . $format; } if ($maxBitRate) { $params .= '&bitrate=' . $maxBitRate; } if ($timeOffset) { $params .= '&frame=' . $timeOffset; } $url = ''; if (Subsonic_XML_Data::isVideo($fileid)) { $url = Video::play_url(Subsonic_XML_Data::getAmpacheId($fileid), $params, 'api', function_exists('curl_version')); } elseif (Subsonic_XML_Data::isSong($fileid)) { $url = Song::play_url(Subsonic_XML_Data::getAmpacheId($fileid), $params, 'api', function_exists('curl_version')); } elseif (Subsonic_XML_Data::isPodcastEp($fileid)) { $url = Podcast_Episode::play_url(Subsonic_XML_Data::getAmpacheId($fileid), $params, 'api', function_exists('curl_version')); } if (!empty($url)) { self::follow_stream($url); } }
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; }