Tons of fixes/tweaks/changes in general
[jamaendo] / jamaui / favorites.py
index d607a8b..5a0474c 100644 (file)
@@ -69,15 +69,13 @@ class FavoritesWindow(hildon.StackableWindow):
                                                                msg)
                 banner.set_timeout(3000)
 
-            for item in settings.favorites:
-                try:
-                    if isinstance(item, tuple) and len(item) == 2:
-                        ftype, fid = item
-                        if ftype == 'album':
-                            add_album(fid, lambda: jamaendo.get_album(fid))
+            favorite_albums = [f[1] for f in settings.favorites if isinstance(f, tuple) and len(f) == 2 and f[0] == 'album' and f[1] not in self.idmap]
+            try:
+                for album in jamaendo.get_albums(favorite_albums):
+                    add_album(album.ID, lambda: album)
 
-                except jamaendo.JamendoAPIException, e:
-                    log.exception("jamaendo.get_album(%s)"%(fid))
+            except jamaendo.JamendoAPIException, e:
+                log.exception("jamaendo.get_albums(%s)"%(favorite_albums))
 
             self.add(self.panarea)
 
@@ -117,7 +115,7 @@ enter your username</span>
     def row_activated(self, treeview, path, view_column):
         _id = self.results.get_album_id(path)
         item = self.idmap[_id]
-        print _id, item
+        #print _id, item
         self.open_item(item)
 
     def open_item(self, item):