def dashboard(lastid=0, offset=0): # setview_thumb() likes = {} listlikes = [] litems = [] strpage = str(((int(offset) + 20) / 20)) # results = tclient.dashboard(offset=offset, limit=100) results = tclient.dashboard(limit=20, offset=offset, type='video', since_id=lastid) nextoff = int(20 + int(offset)) nextitem = ListItem(label="Next Page -> #{0}".format(int(strpage) + 1), label2="Liked Videos", icon=__imgnext__, thumbnail=__imgnext__, path=plugin.url_for(dashboard, offset=nextoff, lastid=lastid)) nextitem.set_art({ 'poster': __imgnext__, 'thumbnail': __imgnext__, 'fanart': __imgnext__ }) nextitem.is_folder = True # litems = [nextitem] litems = [] alltags = [] if results is not None: if results.get('posts', None) is not None: if results.get('posts', None): results = results.get('posts', '') try: if isinstance(results, list): listlikes = results else: listlikes = results.get(results.keys()[0]) except: listlikes = [] else: listlikes = results.get(results.keys()[-1]) litems, alltags = dashboard_items(listlikes) item = listlikes[-1] nextid = item.get('id', ) plugin.set_setting('lastid', nextid) if nextid >= lastid - 20: newid, nextid = get_postids(ForceUpdate=True) newoff = -1 * (newid - nextid) nextitem.path = plugin.url_for(dashboard, offset=newoff, lastid=newid) msgrefresh = "Current ID:{0} Starting Newest ID: {1} off: {2} Latest PostID: {3} new Offset: {4})".format( str(lastid), str(newid), str(nextid), str(offset), str(newoff)) plugin.notify(msgrefresh) savetags(alltags) litems.append(nextitem) return litems
def test_path(self): item = ListItem() self.assertIsNone(item.path) item.path = 'bar' self.assertEqual(item.path, 'bar') self.assertEqual(item.get_path(), 'bar') item.set_path('baz') self.assertEqual(item.path, 'baz') self.assertEqual(item.get_path(), 'baz')
def test___str__(self): item = ListItem() item.path = "somePath" item.label = "sameLabel" self.assertEqual(item.__str__(), u"sameLabel (somePath)") self.assertEqual(str(item), u"sameLabel (somePath)")