summaryrefslogtreecommitdiffstats
path: root/lib/class/metadata.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-08-06 07:23:42 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-08-06 07:23:42 +0000
commit0949ff48904b06438fc4215854d7fa3ba884474e (patch)
tree1ada94218223d74853d17023a919eddf16fac23c /lib/class/metadata.class.php
parent0b4194ebf11e2ce8b59563c57a4eeca8c80a70e8 (diff)
downloadampache-0949ff48904b06438fc4215854d7fa3ba884474e.tar.gz
ampache-0949ff48904b06438fc4215854d7fa3ba884474e.tar.bz2
ampache-0949ff48904b06438fc4215854d7fa3ba884474e.zip
fixed find missing tracks, tweaked openstrands class again to account for lack of [[CCDATA tag on some xml responses
Diffstat (limited to 'lib/class/metadata.class.php')
-rw-r--r--lib/class/metadata.class.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/class/metadata.class.php b/lib/class/metadata.class.php
index 30a34f4b..8f5abf2b 100644
--- a/lib/class/metadata.class.php
+++ b/lib/class/metadata.class.php
@@ -85,6 +85,48 @@ class metadata {
} // recommend_similar
+ /**
+ * find_missing_tracks
+ * This returns an array of song objects using the construct_from_array() that are
+ * not in the specified album.
+ */
+ public static function find_missing_tracks($album_id) {
+
+ // Build our object
+ $album = new Album($album_id);
+ $objects = array();
+
+ // For now it's only mystrands
+ OpenStrands::set_auth_token(Config::get('mystrands_developer_key'));
+ $openstrands = new OpenStrands($GLOBALS['user']->prefs['mystrands_user'],$GLOBALS['user']->prefs['mystrands_pass']);
+
+ if (!$openstrands) { return false; }
+
+ // First find the album on mystrands
+ $result = $openstrands->search_albums($album->full_name,'1');
+
+ $mystrands_id = $result['0']['__attributes']['AlbumId'];
+
+ if (!$mystrands_id) { return false; }
+
+ $tracks = $openstrands->lookup_album_tracks($mystrands_id);
+
+ // Recurse the data we've found and check the local album
+ foreach ($tracks as $track) {
+ if (!$album->has_track($track['TrackName'])) {
+ $data['title'] = $track['TrackName'];
+ $data['track'] = $track['TrackNumber'];
+ $data['disc'] = $track['DiscNumber'];
+ $data['artist'] = $track['ArtistName'];
+ $data['links'] = "<a target=\"_blank\" href=\"" . $track['URI'] . "\">" . get_user_icon('world_link','MyStrands') . "</a>";
+ $objects[] = Album::construct_from_array($data);
+ }
+ } // end foreach
+
+ return $objects;
+
+ } // find_missing_tracks
+
} // metadata
?>