From 88279612efc1bd7cc341d9a3d0682b561d07fe0d Mon Sep 17 00:00:00 2001 From: src386 Date: Thu, 10 Sep 2015 09:23:03 +0200 Subject: [PATCH] update to movim 0.9-2015-09-10 --- README.md | 4 ++-- sources/app/models/contact/Contact.php | 20 ++++++++++++++++++++ sources/app/widgets/Contact/Contact.php | 20 -------------------- sources/app/widgets/Contact/_contact.tpl | 24 +++++++++++------------- sources/app/widgets/Roster/roster.tpl | 6 +++--- 5 files changed, 36 insertions(+), 38 deletions(-) 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"}