diff options
author | momo-i <momo-i@ampache> | 2009-03-09 23:28:22 +0000 |
---|---|---|
committer | momo-i <momo-i@ampache> | 2009-03-09 23:28:22 +0000 |
commit | 99f3067717f2dbf863f873780a5263767096f2bb (patch) | |
tree | 739019b7241448435f57b6ea4e8a3a24a9a10919 /lib/class/artist.class.php | |
parent | 80e16c888b961c95bcb5968b1534f3c61f53381c (diff) | |
download | ampache-99f3067717f2dbf863f873780a5263767096f2bb.tar.gz ampache-99f3067717f2dbf863f873780a5263767096f2bb.tar.bz2 ampache-99f3067717f2dbf863f873780a5263767096f2bb.zip |
Updated: encode multibyte lyrics, if lyrics hasn't encoded UTF-8. Get lyrics from id3v2 tag(feature not implement)
Diffstat (limited to 'lib/class/artist.class.php')
-rw-r--r-- | lib/class/artist.class.php | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php index a5261b10..d488e003 100644 --- a/lib/class/artist.class.php +++ b/lib/class/artist.class.php @@ -288,29 +288,36 @@ class Artist extends database_object { * gets the lyrics of $this->song * if they are not in the database, fetch using LyricWiki (SOAP) and insert */ - function get_song_lyrics($song_id, $artist_name, $song_title) { + public function get_song_lyrics($song_id, $artist_name, $song_title) { - $sql = "SELECT lyrics FROM song_data WHERE `song_id`='" . Dba::escape($song_id) . "'"; + $sql = "SELECT `lyrics`.`song_data` FROM `song_data` WHERE `song_id`='" . Dba::escape($song_id) . "'"; $db_results = Dba::query($sql); $results = Dba::fetch_assoc($db_results); - $rs = Dba::read("SELECT file FROM song WHERE `id`='" . Dba::escape($song_id) . "'"); + // Get Lyrics From id3tag (Lyrics3) + $rs = Dba::read("SELECT `file`.`song` FROM `song` WHERE `id`='" . Dba::escape($song_id) . "'"); $filename = Dba::fetch_row($rs); $vainfo = new vainfo($filename[0], '','','',$catalog->sort_pattern,$catalog->rename_pattern); $vainfo->get_info(); $key = vainfo::get_tag_type($vainfo->tags); $tag_lyrics = vainfo::clean_tag_info($vainfo->tags,$key,$filename); $lyrics = $tag_lyrics['lyrics']; - if(function_exists('mb_detect_encoding') AND function_exists('mb_convert_encoding')) { - $enc = mb_detect_encoding($lyrics); - $lyrics = mb_convert_encoding($lyrics, 'UTF-8', $enc); + + if (empty($lyrics)) { + // Get Lyrics From id3tag (id3v2 USLT/SYLT) } if (strlen($results['lyrics']) > 1) { return html_entity_decode(strip_tags(($results['lyrics'])), ENT_QUOTES); } elseif (strlen($lyrics) > 1) { - /// get lyrics from id3tag + // encode lyrics utf8 + if (function_exists('mb_detect_encoding') AND function_exists('mb_convert_encoding')) { + $enc = mb_detect_encoding($lyrics); + if ($enc != "ASCII" OR $enc != "UTF-8") { + $lyrics = mb_convert_encoding($lyrics, 'UTF-8', $enc); + } + } return $lyrics; } else { |