Skip to content
Snippets Groups Projects
Commit 2e313135 authored by Alex Arnaud's avatar Alex Arnaud
Browse files

hotline#14175 - Use title to match album if nothing has been found in LastFm.

parent cb56eaa7
Branches
Tags
3 merge requests!318Master,!317Hotline 6.48,!309Hotline#14175 lastfm
- ticket #14175: Récupération des albums LastFm: Si la procédure habituelle ne fonctionne pas, comparaison avec le titre uniquement.
- ticket #14175: Amélioration de la comparaison des artistes dans la récupération des photos LastFM.
24/07/2014 - v6.48.1
......
......@@ -77,6 +77,16 @@ class Class_WebService_Lastfm extends Class_WebService_Abstract {
$album = $artist = '';
}
if (!$album) {
foreach($nodes as $node) {
$album = $this->xml->get_child_value($node, "NAME");
if (strtoupper($titre) == strtoupper($album))
break;
$album = $artist = '';
}
}
if (!$album)
return false;
......
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<lfm status="ok">
<results for="MONSIEUR GAINSBOURG REVISITED" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<opensearch:Query role="request" searchTerms="MONSIEUR GAINSBOURG REVISITED" startPage="1" />
<opensearch:totalResults>1</opensearch:totalResults>
<opensearch:startIndex>0</opensearch:startIndex>
<opensearch:itemsPerPage>50</opensearch:itemsPerPage><albummatches>
<album>
<name>Monsieur Gainsbourg Revisited</name>
<artist>Various Artists</artist>
<id>2857031</id>
<url>http://www.last.fm/music/Various+Artists/Monsieur+Gainsbourg+Revisited</url>
<image size="small">http://userserve-ak.last.fm/serve/34s/50649339.png</image>
<image size="medium">http://userserve-ak.last.fm/serve/64s/50649339.png</image>
<image size="large">http://userserve-ak.last.fm/serve/126/50649339.png</image>
<image size="extralarge">http://userserve-ak.last.fm/serve/300x300/50649339.png</image>
<streamable>0</streamable>
<mbid>d2b1d49f-eefb-45f4-a067-8eb481618752</mbid>
</album>
</albummatches>
</results></lfm>
......@@ -119,6 +119,34 @@ class LastfmParserTest extends LastfmParserTestCase {
}
class LastfmGetAblbumGainsbourgRevisitedTest extends LastfmParserTestCase {
public function setUp() {
parent::setUp();
$this->_http_client
->whenCalled('open_url')
->with('http://ws.audioscrobbler.com/2.0/?api_key=76d470da0d3d5cb08a7025aae2c8686a&method=album.search&album=MONSIEUR+GAINSBOURG+REVISITED')
->answers(file_get_contents(realpath(dirname(__FILE__)). '/../../../fixtures/lastfm_album_monsieur_gainsbourg_revisited.xml'))
->whenCalled('open_url')
->with('http://www.last.fm/music/Various+Artists/Monsieur+Gainsbourg+Revisited')
->answers(file_get_contents(realpath(dirname(__FILE__)). '/../../../fixtures/lastfm_album_monsieur_gainsbourg_revisited.html'))
->beStrict();
$this->_album = $this->_last_fm->getMorceaux('Monsieur Gainsbourg revisited', 'Serge Gainsbourg');
}
/** @test */
public function ThirteenthTrackShouldHaveTitleTheBalladOfBonnieAndClyde() {
$this->assertEquals('The Ballad Of Bonnie And Clyde',
$this->_album['morceaux'][1][13]['titre']);
}
}
class LastfmGetPhotosRageAgainstTheMachineTest extends LastfmParserTestCase {
public function setUp() {
parent::setUp();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment