Permalink
Browse files

[mod] insert processing data method to make filters for last.fm data …

…possible
  • Loading branch information...
1 parent 9f5b9c6 commit 50cb6c99afe2ac15d417344cf2f3739b682ad7c0 @haschek committed Mar 18, 2012
Showing with 53 additions and 20 deletions.
  1. +53 −20 lib/Services/Lastfm.php
View
@@ -2,11 +2,12 @@
defined('PUBWICH') or die('No direct access allowed.');
/**
- * @classname LastFM
* @description Fetch data from Last.fm
- * @version 1.2 (20100526)
- * @author Rémi Prévost (exomel.com)
- * @methods LastFMWeeklyAlbums LastFMRecentTracks LastFMTopAlbums
+ * @author Rémi Prévost
+ * @author Gareth Simpson
+ * @author http://michael.haschke.biz/
+ * @methods LastFMRecentTracks LastFMLovedTracks LastFMWeeklyTracks LastFMWeeklyAlbums LastFMTopAlbums
+ * @version GPL2
*/
class LastFM extends Service {
@@ -54,10 +55,11 @@ public function getData() {
return $data->recenttracks->track;
}
- /**
- * @return array
- */
- public function populateItemTemplate( &$item ) {
+ /**
+ * @return array
+ * @since 20120318
+ */
+ public function processDataItem( $item ) {
$album = $item->album;
$artist = $item->artist;
$title= $item->name;
@@ -69,6 +71,13 @@ public function populateItemTemplate( &$item ) {
'track' => $title,
'date' => $item->date,
);
+ }
+
+ /**
+ * @return array
+ */
+ public function populateItemTemplate( &$item ) {
+ return $item;
}
}
@@ -93,10 +102,11 @@ public function getData() {
return $data->lovedtracks->track;
}
- /**
- * @return array
- */
- public function populateItemTemplate( &$item ) {
+ /**
+ * @return array
+ * @since 20120318
+ */
+ public function processDataItem( $item ) {
$artist = $item->artist->name;
$title= $item->name;
$this->compteur++;
@@ -106,6 +116,13 @@ public function populateItemTemplate( &$item ) {
'track' => $title,
'date' => $item->date,
);
+ }
+
+ /**
+ * @return array
+ */
+ public function populateItemTemplate( &$item ) {
+ return $item;
}
}
@@ -130,10 +147,11 @@ public function getData() {
return $data->weeklytrackchart->track;
}
- /**
- * @return array
- */
- public function populateItemTemplate( &$item ) {
+ /**
+ * @return array
+ * @since 20120318
+ */
+ public function processDataItem( $item ) {
$artist = $item->artist;
$title= $item->name;
$this->compteur++;
@@ -144,6 +162,13 @@ public function populateItemTemplate( &$item ) {
'date' => $item->date,
'playcount' => $item->playcount,
);
+ }
+
+ /**
+ * @return array
+ */
+ public function populateItemTemplate( &$item ) {
+ return $item;
}
}
@@ -178,10 +203,11 @@ public function getData() {
return $data->topalbums->album;
}
- /**
- * @return array
- */
- public function populateItemTemplate( &$item ) {
+ /**
+ * @return array
+ * @since 20120318
+ */
+ public function processDataItem( $item ) {
$images = new StdClass;
foreach( $item->image as $k=>$i ) {
$key = (string) $i['size'];
@@ -199,5 +225,12 @@ public function populateItemTemplate( &$item ) {
'image_large' => $images->large,
'image_extralarge' => $images->extralarge,
);
+ }
+
+ /**
+ * @return array
+ */
+ public function populateItemTemplate( &$item ) {
+ return $item;
}
}

0 comments on commit 50cb6c9

Please sign in to comment.