SwissCenter is an open source project powered by Assembla

Assembla offers free public and private SVN/Git repositories and project hosting with bug/issue tracking and collaboration tools.

Commit 1701

User picture
  • Author: Pernod
  • 2012-05-20 06:47 (almost 2 years ago)

Updated the retrieval of music lyrics due to changes at MetroLyrics.

Files Affected

 
17001701
19
  $lyrics = $metro->getLyrics($artist, $track);
19
  $lyrics = $metro->getLyrics($artist, $track);
20
 
20
 
21
  // Check for no lyrics available
21
  // Check for no lyrics available
22
  if ( strpos($lyrics, 'www.metrolyrics.com') > 0 )
22
  if ( $lyrics === false )
23
  {
23
  {
24
    page_inform(2, page_hist_previous(), $artist.' - '.$track,str('NO_LYRICS_AVAILABLE'));
24
    page_inform(2, page_hist_previous(), $artist.' - '.$track,str('NO_LYRICS_AVAILABLE'));
25
  }
25
  }
17001701
34
 
34
 
35
    if (!($lyrics = $this->cache->getCached($request))) {
35
    if (!($lyrics = $this->cache->getCached($request))) {
36
      if (($body = file_get_contents($request)) !== false) {
36
      if (($body = file_get_contents($request)) !== false) {
37
        $lyrics = preg_get('/<p id="lyrics">(.*)<\/p>/U', $body);
37
        $lyrics = preg_get('/<div id="lyrics-body">(.*)<\/div>/Usm', $body);
38
        $lyrics = html_entity_decode($lyrics);
38
        $lyrics = html_entity_decode($lyrics);
39
        $this->cache->cache($request, $lyrics);
39
        $this->cache->cache($request, $lyrics);
40
      } else {
40
      } else {