diff --git a/INFO b/INFO index 48acc34..c486822 100644 --- a/INFO +++ b/INFO @@ -1,10 +1,10 @@ { - "name": "NetEaseLrc", + "name": "ludysu_neteaselrc", "displayname": "NE Cloud Music Lrc", - "description": "", + "description": "NE Cloud Music Lrc", "version": "1.0", "site": "http://music.163.com", "module": "netease.php", "type": "lyric", - "class": "NetEaseLrc" + "class": "LudysuNetEaseLrc" } diff --git a/netease.php b/netease.php index 4a761c6..6a5a66b 100644 --- a/netease.php +++ b/netease.php @@ -1,12 +1,16 @@ isNullOrEmptyString($title)) { - echo "song title is empty"; return 0; } $response = $this->search($title); if ($this->isNullOrEmptyString($response)) { - echo "===== no songs found in the response"; return 0; } @@ -30,7 +32,6 @@ class NetEaseLrc { $foundArray = array(); if(count($songArray) == 0) { - echo "===== no songs found"; return 0; } @@ -38,7 +39,6 @@ class NetEaseLrc { $exactMatchArray = array(); $partialMatchArray = array(); foreach ($songArray as $song) { - echo "$title ===(" . $song['name'] . ")
"; if (strtolower($title) === strtolower($song['name'])) { array_push($exactMatchArray, $song); } else if (strpos($song['name'], $title) || strpos($title, $song['name'])) { @@ -47,10 +47,8 @@ class NetEaseLrc { } if (count($exactMatchArray) != 0) { - echo "exact matched titles " . count($exactMatchArray) ."
"; $songArray = $exactMatchArray; } else if (count($partialMatchArray != 0)) { - echo "part match " . count($partialMatchArray) . "
"; $songArray = $partialMatchArray; } @@ -58,16 +56,13 @@ class NetEaseLrc { foreach ($songArray as $song) { foreach ($song['artists'] as $item) { if (strtolower($item['name']) === strtolower($artist)) { - echo "====== found " . $song['id'] . "
"; array_push($foundArray, $song['id']); break; } } } - echo "found " . count($foundArray) . " exact match artist songs =====
"; if (count($foundArray) == 0) { - echo "no match artist found, picking any match
"; foreach ($songArray as $song) { array_push($foundArray, $song["id"]); } @@ -79,7 +74,7 @@ class NetEaseLrc { $info->addTrackInfoToList($artist, $title, $songId, ''); } - return count($foundArray); + return count($foundArray) ; } /** @@ -134,11 +129,9 @@ class NetEaseLrc { $url = "http://music.163.com/api/song/lyric?os=pc&id=" . $music_id . "&lv=-1&kv=0&tv=-1"; $response = $this->download($url); if ($this->isNullOrEmptyString($response)) { - echo "Can not download lyrics id '$music_id'"; return NULL; } -// var_dump($response);echo "
========
"; $json = json_decode($response, true); return $json['lrc']['lyric']; } @@ -220,7 +213,7 @@ if ($DEBUG == true) { echo "Trying to find lyrics for ['$title'] by artist ['$artist'] ...
"; $testObj = new TestObj(); - $downloader = (new ReflectionClass("NetEaseLrc"))->newInstance(); + $downloader = (new ReflectionClass("LudysuNetEaseLrc"))->newInstance(); $count = $downloader->getLyricsList($artist, $title, $testObj); if ($count > 0) { $item = $testObj->getFirstItem();