def get_users_contacts( self ):
     # get client
     from PicasaAPI.PicasaClient import PicasaClient
     client = PicasaClient()
     # initialize our category tuple
     categories = ()
     # get settings
     user_id = xbmcplugin.getSetting( "user_email" )
     perpage = ( 10, 15, 20, 25, 30, 40, 50, 75, 100, )[ int( xbmcplugin.getSetting( "perpage" ) ) ]
     thumbsize = ( 72, 144, 160, 200, 288, 320, 400, 512, )[ int( xbmcplugin.getSetting( "thumbsize" ) ) ]
     access = ( "all", "private", "public", )[ int( xbmcplugin.getSetting( "access" ) ) ]
     # starting item
     start_index = ( self.args.page - 1 ) * perpage + 1
     # fetch the items
     feed = client.users_contacts( user_id=user_id, album_id="", photo_id="", pq="", kind="user", imgmax="d", thumbsize=thumbsize, authkey=xbmcplugin.getSetting( "authkey" ), access=access, start__index=start_index, max__results=perpage, q="" )
     # if there were results
     if ( feed ):
         #{'items': [{'thumb_url': u'http://lh3.ggpht.com/_NMYCpWBWM8Y/AAAAW8QQU-U/AAAAAAAAAAA/BPOH5yeOD1M/s64-c/gotoidan.jpg', 'nickname': u'Idan', 'user': u'gotoidan'}], 'totalResults': 1}
         # enumerate thru and add user
         for user in feed[ "items" ]:
             # add user to our dictionary
             categories += ( ( user[ "nickname" ].encode( "utf-8" ), "users_contacts_photos", "", user[ "user" ].encode( "utf-8" ), True, 0, "photo", access, user[ "thumb_url" ], False, ), )
     # return results
     return categories
Пример #2
0
 def get_users_contacts(self):
     # get client
     from PicasaAPI.PicasaClient import PicasaClient
     client = PicasaClient()
     # initialize our category tuple
     categories = ()
     # get settings
     user_id = xbmcplugin.getSetting("user_email")
     perpage = (
         10,
         15,
         20,
         25,
         30,
         40,
         50,
         75,
         100,
     )[int(xbmcplugin.getSetting("perpage"))]
     thumbsize = (
         72,
         144,
         160,
         200,
         288,
         320,
         400,
         512,
     )[int(xbmcplugin.getSetting("thumbsize"))]
     access = (
         "all",
         "private",
         "public",
     )[int(xbmcplugin.getSetting("access"))]
     # starting item
     start_index = (self.args.page - 1) * perpage + 1
     # fetch the items
     feed = client.users_contacts(user_id=user_id,
                                  album_id="",
                                  photo_id="",
                                  pq="",
                                  kind="user",
                                  imgmax="d",
                                  thumbsize=thumbsize,
                                  authkey=xbmcplugin.getSetting("authkey"),
                                  access=access,
                                  start__index=start_index,
                                  max__results=perpage,
                                  q="")
     # if there were results
     if (feed):
         #{'items': [{'thumb_url': u'http://lh3.ggpht.com/_NMYCpWBWM8Y/AAAAW8QQU-U/AAAAAAAAAAA/BPOH5yeOD1M/s64-c/gotoidan.jpg', 'nickname': u'Idan', 'user': u'gotoidan'}], 'totalResults': 1}
         # enumerate thru and add user
         for user in feed["items"]:
             # add user to our dictionary
             categories += ((
                 user["nickname"].encode("utf-8"),
                 "users_contacts_photos",
                 "",
                 user["user"].encode("utf-8"),
                 True,
                 0,
                 "photo",
                 access,
                 user["thumb_url"],
                 False,
             ), )
     # return results
     return categories