diff --git a/README.md b/README.md index a16a1f8..316e4ef 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,12 @@ Warning: BETA. You need a valid SSL certificate to use Movim, auto-signed is not allowed. -Current Movim version : 0.9 git2015-09-07 +Current Movim version : 0.9 git2015-09-10 **Changelog** 0.9b 2015-0 -- Update to Movim 0.9 git2015-09-07 +- Update to Movim 0.9 git2015-09-10 - Add notes in README about public pods & whitelisting - script/install now check if path is empty. - script/remove now delete /etc/php/fpm/pool.d/movim.conf (fix #8). diff --git a/sources/app/models/contact/Contact.php b/sources/app/models/contact/Contact.php index 0f83065..f27132c 100644 --- a/sources/app/models/contact/Contact.php +++ b/sources/app/models/contact/Contact.php @@ -389,6 +389,26 @@ class Contact extends Model { } } + function getAlbum() + { + $uri = str_replace( + ' ', + '%20', + 'http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=80c1aa3abfa9e3d06f404a2e781e38f9&artist='. + $this->tuneartist. + '&album='. + $this->tunesource. + '&format=json' + ); + + $json = json_decode(requestURL($uri, 2)); + + if($json->album) { + $json->album->url = $json->album->image[2]->{'#text'}; + return $json->album; + } + } + function toRoster() { return array( 'jid' => $this->jid, diff --git a/sources/app/widgets/Contact/Contact.php b/sources/app/widgets/Contact/Contact.php index 392a3b5..35eac2c 100644 --- a/sources/app/widgets/Contact/Contact.php +++ b/sources/app/widgets/Contact/Contact.php @@ -271,26 +271,6 @@ class Contact extends WidgetBase } } - function getLastFM($contact) - { - $uri = str_replace( - ' ', - '%20', - 'http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=80c1aa3abfa9e3d06f404a2e781e38f9&artist='. - $contact->tuneartist. - '&album='. - $contact->tunesource. - '&format=json' - ); - - $json = json_decode(requestURL($uri, 2)); - - $img = $json->album->image[2]->{'#text'}; - $url = $json->album->url; - - return array($img, $url); - } - /** * @brief Validate the jid * diff --git a/sources/app/widgets/Contact/_contact.tpl b/sources/app/widgets/Contact/_contact.tpl index 277b663..04eb608 100644 --- a/sources/app/widgets/Contact/_contact.tpl +++ b/sources/app/widgets/Contact/_contact.tpl @@ -172,26 +172,25 @@ {/if} - {if="$contact->tuneartist || $contact->tunetitle"} + {$album = $contact->getAlbum()} + {if="$album"}