本文整理汇总了PHP中Song::fill_ext_info方法的典型用法代码示例。如果您正苦于以下问题:PHP Song::fill_ext_info方法的具体用法?PHP Song::fill_ext_info怎么用?PHP Song::fill_ext_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Song
的用法示例。
在下文中一共展示了Song::fill_ext_info方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Song
break;
}
$song = new Song($_REQUEST['song_id']);
if (!Catalog::can_remove($song)) {
debug_event('song', 'Unauthorized to remove the song `.' . $song->id . '`.', 1);
UI::access_denied();
exit;
}
if ($song->remove_from_disk()) {
show_confirmation(T_('Song Deletion'), T_('Song has been deleted.'), AmpConfig::get('web_path'));
} else {
show_confirmation(T_('Song Deletion'), T_('Cannot delete this song.'), AmpConfig::get('web_path'));
}
break;
case 'show_lyrics':
$song = new Song($_REQUEST['song_id']);
$song->format();
$song->fill_ext_info();
$lyrics = $song->get_lyrics();
require_once AmpConfig::get('prefix') . UI::find_template('show_lyrics.inc.php');
break;
case 'show_song':
default:
$song = new Song($_REQUEST['song_id']);
$song->format();
$song->fill_ext_info();
require_once AmpConfig::get('prefix') . UI::find_template('show_song.inc.php');
break;
}
// end data collection
UI::show_footer();
示例2: addLyrics
public static function addLyrics($xml, $artist, $title, $song_id)
{
$song = new Song($song_id);
$song->format();
$song->fill_ext_info();
$lyrics = $song->get_lyrics();
if ($lyrics && $lyrics['text']) {
$text = preg_replace('/\\<br(\\s*)?\\/?\\>/i', "\n", $lyrics['text']);
$text = str_replace("\r", '', $text);
$xlyrics = $xml->addChild("lyrics", $text);
if ($artist) {
$xlyrics->addAttribute("artist", $artist);
}
if ($title) {
$xlyrics->addAttribute("title", $title);
}
}
}
示例3: update_song_from_tags
/**
* update_song_from_tags
* Updates the song info based on tags; this is called from a bunch of
* different places and passes in a full fledged song object, so it's a
* static function.
* FIXME: This is an ugly mess, this really needs to be consolidated and
* cleaned up.
* @param array $results
* @param \Song $song
* @return array
*/
public static function update_song_from_tags($results, Song $song)
{
/* Setup the vars */
$new_song = new Song();
$new_song->file = $results['file'];
$new_song->title = $results['title'];
$new_song->year = $results['year'];
$new_song->comment = $results['comment'];
$new_song->language = $results['language'];
$new_song->lyrics = str_replace(array("\r\n", "\r", "\n"), '<br />', strip_tags($results['lyrics']));
$new_song->bitrate = $results['bitrate'];
$new_song->rate = $results['rate'];
$new_song->mode = $results['mode'] == 'cbr' ? 'cbr' : 'vbr';
$new_song->size = $results['size'];
$new_song->time = $results['time'];
$new_song->mime = $results['mime'];
$new_song->track = intval($results['track']);
$new_song->mbid = $results['mb_trackid'];
$new_song->label = $results['publisher'];
$new_song->composer = $results['composer'];
$new_song->replaygain_track_gain = floatval($results['replaygain_track_gain']);
$new_song->replaygain_track_peak = floatval($results['replaygain_track_peak']);
$new_song->replaygain_album_gain = floatval($results['replaygain_album_gain']);
$new_song->replaygain_album_peak = floatval($results['replaygain_album_peak']);
$tags = Tag::get_object_tags('song', $song->id);
if ($tags) {
foreach ($tags as $tag) {
$song->tags[] = $tag['name'];
}
}
$new_song->tags = $results['genre'];
$artist = $results['artist'];
$artist_mbid = $results['mb_artistid'];
$albumartist = $results['albumartist'] ?: $results['band'];
$albumartist = $albumartist ?: null;
$albumartist_mbid = $results['mb_albumartistid'];
$album = $results['album'];
$album_mbid = $results['mb_albumid'];
$album_mbid_group = $results['mb_albumid_group'];
$disk = $results['disk'];
/*
* We have the artist/genre/album name need to check it in the tables
* If found then add & return id, else return id
*/
$new_song->artist = Artist::check($artist, $artist_mbid);
if ($albumartist) {
$new_song->albumartist = Artist::check($albumartist, $albumartist_mbid);
}
$new_song->album = Album::check($album, $new_song->year, $disk, $album_mbid, $album_mbid_group, $new_song->albumartist);
$new_song->title = self::check_title($new_song->title, $new_song->file);
/* Since we're doing a full compare make sure we fill the extended information */
$song->fill_ext_info();
if (Song::isCustomMetadataEnabled()) {
$ctags = self::get_clean_metadata($song, $results);
if (method_exists($song, 'updateOrInsertMetadata') && $song::isCustomMetadataEnabled()) {
$ctags = array_diff_key($ctags, array_flip($song->getDisabledMetadataFields()));
foreach ($ctags as $tag => $value) {
$field = $song->getField($tag);
$song->updateOrInsertMetadata($field, $value);
}
}
}
$info = Song::compare_song_information($song, $new_song);
if ($info['change']) {
debug_event('update', "{$song->file} : differences found, updating database", 5);
// Duplicate arts if required
if ($song->artist != $new_song->artist) {
if (!Art::has_db($new_song->artist, 'artist')) {
Art::duplicate('artist', $song->artist, $new_song->artist);
}
}
if ($song->albumartist != $new_song->albumartist) {
if (!Art::has_db($new_song->albumartist, 'artist')) {
Art::duplicate('artist', $song->albumartist, $new_song->albumartist);
}
}
if ($song->album != $new_song->album) {
if (!Art::has_db($new_song->album, 'album')) {
Art::duplicate('album', $song->album, $new_song->album);
}
}
$song->update_song($song->id, $new_song);
if ($song->tags != $new_song->tags) {
Tag::update_tag_list(implode(',', $new_song->tags), 'song', $song->id, true);
self::updateAlbumTags($song);
self::updateArtistTags($song);
}
// Refine our reference
//$song = $new_song;
//.........这里部分代码省略.........
示例4: update_song_from_tags
/**
* update_song_from_tags
* Updates the song info based on tags; this is called from a bunch of
* different places and passes in a full fledged song object, so it's a
* static function.
* FIXME: This is an ugly mess, this really needs to be consolidated and
* cleaned up.
* @param array $results
* @param \Song $song
* @return array
*/
public static function update_song_from_tags($results, Song $song)
{
/* Setup the vars */
$new_song = new Song();
$new_song->file = $results['file'];
$new_song->title = $results['title'];
$new_song->year = $results['year'];
$new_song->comment = $results['comment'];
$new_song->language = $results['language'];
$new_song->lyrics = str_replace(array("\r\n", "\r", "\n"), '<br />', strip_tags($results['lyrics']));
$new_song->bitrate = $results['bitrate'];
$new_song->rate = $results['rate'];
$new_song->mode = $results['mode'] == 'cbr' ? 'cbr' : 'vbr';
$new_song->size = $results['size'];
$new_song->time = $results['time'];
$new_song->mime = $results['mime'];
$new_song->track = intval($results['track']);
$new_song->mbid = $results['mb_trackid'];
$new_song->label = $results['publisher'];
$new_song->composer = $results['composer'];
$new_song->replaygain_track_gain = floatval($results['replaygain_track_gain']);
$new_song->replaygain_track_peak = floatval($results['replaygain_track_peak']);
$new_song->replaygain_album_gain = floatval($results['replaygain_album_gain']);
$new_song->replaygain_album_peak = floatval($results['replaygain_album_peak']);
$tags = Tag::get_object_tags('song', $song->id);
if ($tags) {
foreach ($tags as $tag) {
$song->tags[] = $tag['name'];
}
}
$new_song->tags = $results['genre'];
$artist = $results['artist'];
$artist_mbid = $results['mb_artistid'];
$albumartist = $results['albumartist'] ?: $results['band'];
$albumartist = $albumartist ?: null;
$albumartist_mbid = $results['mb_albumartistid'];
$album = $results['album'];
$album_mbid = $results['mb_albumid'];
$album_mbid_group = $results['mb_albumid_group'];
$disk = $results['disk'];
/*
* We have the artist/genre/album name need to check it in the tables
* If found then add & return id, else return id
*/
$new_song->artist = Artist::check($artist, $artist_mbid);
if ($albumartist) {
$new_song->albumartist = Artist::check($albumartist, $albumartist_mbid);
}
$new_song->album = Album::check($album, $new_song->year, $disk, $album_mbid, $album_mbid_group, $new_song->albumartist);
$new_song->title = self::check_title($new_song->title, $new_song->file);
/* Since we're doing a full compare make sure we fill the extended information */
$song->fill_ext_info();
$info = Song::compare_song_information($song, $new_song);
if ($info['change']) {
debug_event('update', "{$song->file} : differences found, updating database", 5);
// Duplicate arts if required
if ($song->artist != $new_song->artist) {
if (!Art::has_db($new_song->artist, 'artist')) {
Art::duplicate('artist', $song->artist, $new_song->artist);
}
}
if ($song->albumartist != $new_song->albumartist) {
if (!Art::has_db($new_song->albumartist, 'artist')) {
Art::duplicate('artist', $song->albumartist, $new_song->albumartist);
}
}
if ($song->album != $new_song->album) {
if (!Art::has_db($new_song->album, 'album')) {
Art::duplicate('album', $song->album, $new_song->album);
}
}
$song->update_song($song->id, $new_song);
if ($song->tags != $new_song->tags) {
Tag::update_tag_list(implode(',', $new_song->tags), 'song', $song->id, true);
self::updateAlbumTags($song);
self::updateArtistTags($song);
}
// Refine our reference
//$song = $new_song;
} else {
debug_event('update', "{$song->file} : no differences found", 5);
}
return $info;
}