Vlad Svoka avatar Vlad Svoka committed 714eba3

fixed error if there is no albums, changed API to new one

Comments (0)

Files changed (1)

xbmc-vk.svoka.com/xvimage.py

 
 
     def GetAlbums(self):
-        albums=self.api.call("photos.getAlbums")
-        q = []
-        for album in albums:
-            q.append(str(album["owner_id"]) + "_" + str(album["thumb_id"]))
-
-        thumbs = self.api.call("photos.getById", photos=",".join(q))
-        album_thumbs = dict()
-        for e in thumbs:
-            album_thumbs[str(e["aid"])] = e["src"]
-
+        albums=self.api.call("photos.getAlbums", need_covers=1)
         items = []
         for a in albums:
+            print a.get('thumb_src')
             e = ( a["title"] + unicode(" (%s photo)" % a["size"]),
                   a["description"],
-                  album_thumbs[str(a["aid"])],
+                  a.get('thumb_src'),
                   str(a["aid"]),
                   a["owner_id"]  )
             items.append(e)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.