本文整理汇总了PHP中Song::play_url方法的典型用法代码示例。如果您正苦于以下问题:PHP Song::play_url方法的具体用法?PHP Song::play_url怎么用?PHP Song::play_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Song
的用法示例。
在下文中一共展示了Song::play_url方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: library_parts
public static function library_parts($params)
{
$n = count($params);
if ($n > 0) {
$key = $params[0];
if ($n == 2) {
$file = $params[1];
$id = Plex_XML_Data::getAmpacheId($key);
if (Plex_XML_Data::isSong($key)) {
$media = new Song($id);
if ($media->id) {
$url = Song::play_url($id, '', 'api', true);
self::stream_url($url);
} else {
self::createError(404);
}
} elseif (Plex_XML_Data::isVideo($key)) {
$media = new Video($id);
if ($media->id) {
$url = Video::play_url($id, '', 'api', true);
self::stream_url($url);
} else {
self::createError(404);
}
}
} elseif ($n == 1) {
if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
if (isset($_GET['subtitleStreamID'])) {
$lang_code = dechex(hex2bin(substr($_GET['subtitleStreamID'], 0, 2)));
$_SESSION['iframe']['subtitle'] = $lang_code;
}
}
}
}
}
示例2: download
/**
* download
* Downloads a given media file.
* Takes the file id in parameter.
*/
public static function download($input)
{
self::check_version($input, "1.0.0", true);
$fileid = self::check_parameter($input, 'id', true);
$url = Song::play_url(Subsonic_XML_Data::getAmpacheId($fileid), '&action=download' . '&client=' . rawurlencode($input['c']) . '&noscrobble=1', 'api', function_exists('curl_version'));
self::follow_stream($url);
}
示例3: download
/**
* download
* Downloads a given media file.
* Takes the file id in parameter.
*/
public static function download($input)
{
self::check_version($input, "1.0.0", true);
$fileid = self::check_parameter($input, 'id', true);
$url = Song::play_url(Subsonic_XML_Data::getAmpacheId($fileid), '&action=download' . '&client=' . $input['c']);
self::follow_stream($url);
}
示例4: export
/**
* exports the catalog
* it exports all songs in the database to the given export type.
*/
public static function export($type, $catalog_id = '')
{
// Select all songs in catalog
$params = array();
if ($catalog_id) {
$sql = 'SELECT `id` FROM `song` ' . "WHERE `catalog`= ? " . 'ORDER BY `album`, `track`';
$params[] = $catalog_id;
} else {
$sql = 'SELECT `id` FROM `song` ORDER BY `album`, `track`';
}
$db_results = Dba::read($sql, $params);
switch ($type) {
case 'itunes':
echo xml_get_header('itunes');
while ($results = Dba::fetch_assoc($db_results)) {
$song = new Song($results['id']);
$song->format();
$xml = array();
$xml['key'] = $results['id'];
$xml['dict']['Track ID'] = intval($results['id']);
$xml['dict']['Name'] = $song->title;
$xml['dict']['Artist'] = $song->f_artist_full;
$xml['dict']['Album'] = $song->f_album_full;
$xml['dict']['Total Time'] = intval($song->time) * 1000;
// iTunes uses milliseconds
$xml['dict']['Track Number'] = intval($song->track);
$xml['dict']['Year'] = intval($song->year);
$xml['dict']['Date Added'] = date("Y-m-d\\TH:i:s\\Z", $song->addition_time);
$xml['dict']['Bit Rate'] = intval($song->bitrate / 1000);
$xml['dict']['Sample Rate'] = intval($song->rate);
$xml['dict']['Play Count'] = intval($song->played);
$xml['dict']['Track Type'] = "URL";
$xml['dict']['Location'] = Song::play_url($song->id);
echo xoutput_from_array($xml, 1, 'itunes');
// flush output buffer
}
// while result
echo xml_get_footer('itunes');
break;
case 'csv':
echo "ID,Title,Artist,Album,Length,Track,Year,Date Added,Bitrate,Played,File\n";
while ($results = Dba::fetch_assoc($db_results)) {
$song = new Song($results['id']);
$song->format();
echo '"' . $song->id . '","' . $song->title . '","' . $song->f_artist_full . '","' . $song->f_album_full . '","' . $song->f_time . '","' . $song->f_track . '","' . $song->year . '","' . date("Y-m-d\\TH:i:s\\Z", $song->addition_time) . '","' . $song->f_bitrate . '","' . $song->played . '","' . $song->file . "\n";
}
break;
}
// end switch
}
示例5: library_parts
public static function library_parts($params)
{
$n = count($params);
if ($n == 2) {
$key = $params[0];
$file = $params[1];
$id = Plex_XML_Data::getAmpacheId($key);
$song = new Song($id);
if ($song->id) {
$url = Song::play_url($id);
self::stream_url($url);
} else {
self::createError(404);
}
}
}
示例6: databases
/**
* databases
*/
public static function databases($input)
{
// $revision = $_GET['revision-number'];
$o = '';
// Database list
if (count($input) == 0) {
self::check_session('daap.serverdatabases');
$o = self::tlv('dmap.status', 200);
$o .= self::tlv('dmap.updatetype', 0);
$o .= self::tlv('dmap.specifiedtotalcount', 1);
$o .= self::tlv('dmap.returnedcount', 1);
$r = self::tlv('dmap.itemid', 1);
$r .= self::tlv('dmap.persistentid', 1);
$r .= self::tlv('dmap.itemname', 'Ampache');
$counts = Catalog::count_medias();
$r .= self::tlv('dmap.itemcount', $counts['songs']);
$r .= self::tlv('dmap.containercount', count(Playlist::get_playlists()));
$r = self::tlv('dmap.listingitem', $r);
$o .= self::tlv('dmap.listing', $r);
$o = self::tlv('daap.serverdatabases', $o);
} elseif (count($input) == 2) {
if ($input[1] == 'items') {
// Songs list
self::check_session('daap.databasesongs');
$o = self::catalog_songs();
$o = self::tlv('daap.databasesongs', $o);
} elseif ($input[1] == 'containers') {
// Playlist list
self::check_session('daap.databaseplaylists');
$o = self::tlv('dmap.status', 200);
$o .= self::tlv('dmap.updatetype', 0);
$playlists = Playlist::get_playlists();
$searches = Search::get_searches();
$o .= self::tlv('dmap.specifiedtotalcount', count($playlists) + count($searches) + 1);
$o .= self::tlv('dmap.returnedcount', count($playlists) + count($searches) + 1);
$l = self::base_library();
foreach ($playlists as $playlist_id) {
$playlist = new Playlist($playlist_id);
$playlist->format();
$l .= self::tlv_playlist($playlist);
}
foreach ($searches as $search_id) {
$playlist = new Search($search_id, 'song');
$playlist->format();
$l .= self::tlv_playlist($playlist);
}
$o .= self::tlv('dmap.listing', $l);
$o = self::tlv('daap.databaseplaylists', $o);
}
} elseif (count($input) == 3) {
// Stream
if ($input[1] == 'items') {
$finfo = explode('.', $input[2]);
if (count($finfo) == 2) {
$id = intval($finfo[0]);
$type = $finfo[1];
$params = '';
$headers = apache_request_headers();
$client = $headers['User-Agent'];
if (!empty($client)) {
$params .= '&client=' . $client;
}
$params .= '&transcode_to=' . $type;
$url = Song::play_url($id, $params, 'api', true);
self::follow_stream($url);
exit;
}
}
} elseif (count($input) == 4) {
// Playlist
if ($input[1] == 'containers' && $input[3] == 'items') {
$id = intval($input[2]);
self::check_session('daap.playlistsongs');
if ($id == Daap_Api::BASE_LIBRARY) {
$o = self::catalog_songs();
$o = self::tlv('daap.playlistsongs', $o);
} else {
if ($id > Daap_Api::AMPACHEID_SMARTPL) {
$id -= Daap_Api::AMPACHEID_SMARTPL;
$playlist = new Search($id, 'song');
} else {
$playlist = new Playlist($id);
}
if ($playlist->id) {
$meta = explode(',', strtolower($_GET['meta']));
$o = self::tlv('dmap.status', 200);
$o .= self::tlv('dmap.updatetype', 0);
$items = $playlist->get_items();
$song_ids = array();
foreach ($items as $item) {
if ($item['object_type'] == 'song') {
$song_ids[] = $item['object_id'];
}
}
if (AmpConfig::get('memory_cache')) {
Song::build_cache($song_ids);
}
//.........这里部分代码省略.........
示例7: _itemSong
public static function _itemSong($song, $parent)
{
$api_session = AmpConfig::get('require_session') ? Stream::get_session() : false;
$art_url = Art::url($song->album, 'album', $api_session);
$fileTypesByExt = self::_getFileTypes();
$arrFileType = $fileTypesByExt[$song->type];
return array('id' => 'amp://music/songs/' . $song->id, 'parentID' => $parent, 'restricted' => '1', 'dc:title' => self::_replaceSpecialSymbols($song->f_title), 'upnp:class' => isset($arrFileType['class']) ? $arrFileType['class'] : 'object.item.unknownItem', 'upnp:albumArtURI' => $art_url, 'upnp:artist' => self::_replaceSpecialSymbols($song->f_artist), 'upnp:album' => self::_replaceSpecialSymbols($song->f_album), 'upnp:genre' => Tag::get_display($song->tags, false, 'song'), 'upnp:originalTrackNumber' => $song->track, 'res' => Song::play_url($song->id, '', 'api'), 'protocolInfo' => $arrFileType['mime'], 'size' => $song->size, 'duration' => $song->f_time_h . '.0', 'bitrate' => $song->bitrate, 'sampleFrequency' => $song->rate, 'description' => self::_replaceSpecialSymbols($song->comment));
}
示例8: democratic
/**
* democratic
*
* This handles creating an xml document for democratic items, this can be a little complicated
* due to the votes and all of that
*
* @param array $object_ids Object IDs
* @return string return xml
*/
public static function democratic($object_ids = array())
{
if (!is_array($object_ids)) {
$object_ids = array();
}
$democratic = Democratic::get_current_playlist();
$string = '';
foreach ($object_ids as $row_id => $data) {
$song = new $data['object_type']($data['object_id']);
$song->format();
//FIXME: This is duplicate code and so wrong, functions need to be improved
$tag = new Tag($song->tags['0']);
$song->genre = $tag->id;
$song->f_genre = $tag->name;
$tag_string = self::tags_string($song->tags);
$rating = new Rating($song->id, 'song');
$art_url = Art::url($song->album, 'album', $_REQUEST['auth']);
$string .= "<song id=\"" . $song->id . "\">\n" . "\t<title><![CDATA[" . $song->title . "]]></title>\n" . "\t<artist id=\"" . $song->artist . "\"><![CDATA[" . $song->f_artist_full . "]]></artist>\n" . "\t<album id=\"" . $song->album . "\"><![CDATA[" . $song->f_album_full . "]]></album>\n" . "\t<genre id=\"" . $song->genre . "\"><![CDATA[" . $song->f_genre . "]]></genre>\n" . $tag_string . "\t<track>" . $song->track . "</track>\n" . "\t<time>" . $song->time . "</time>\n" . "\t<mime>" . $song->mime . "</mime>\n" . "\t<url><![CDATA[" . Song::play_url($song->id, '', 'api') . "]]></url>\n" . "\t<size>" . $song->size . "</size>\n" . "\t<art><![CDATA[" . $art_url . "]]></art>\n" . "\t<preciserating>" . $rating->get_user_rating() . "</preciserating>\n" . "\t<rating>" . $rating->get_user_rating() . "</rating>\n" . "\t<averagerating>" . $rating->get_average_rating() . "</averagerating>\n" . "\t<vote>" . $democratic->get_vote($row_id) . "</vote>\n" . "</song>\n";
}
// end foreach
$final = self::_header() . $string . self::_footer();
return $final;
}
示例9:
if (AmpConfig::get('share')) {
?>
<?php
Share::display_ui('song', $song->id, false);
?>
<?php
}
?>
<?php
}
?>
<?php
if (Access::check_function('download')) {
?>
<a rel="nohtml" href="<?php
echo Song::play_url($song->id);
?>
"><?php
echo UI::get_icon('link', T_('Link'));
?>
</a>
<a rel="nohtml" href="<?php
echo AmpConfig::get('web_path');
?>
/stream.php?action=download&song_id=<?php
echo $song->id;
?>
"><?php
echo UI::get_icon('download', T_('Download'));
?>
</a>