From 5298cd327819356f8736d3b4f80846d395fe31f0 Mon Sep 17 00:00:00 2001 From: KOL Date: Thu, 17 Dec 2015 22:52:20 +0300 Subject: [PATCH] - Fix second page pagination in My subscriptions --- Contents/Code/__init__.py | 40 ++++++++++++++++++++------------------- Contents/Info.plist | 2 +- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index 38088a6..2326610 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -181,9 +181,10 @@ def MySubscriptions(offset=None): 'ajax': 1, } if offset: + path = 'feed' params.update(JSON.ObjectFromString(offset)) - - path = 'feed' if offset else 'feed/subscriptions' + else: + path = 'feed/subscriptions' try: res = JSON.ObjectFromString(HTTP.Request( @@ -206,14 +207,6 @@ def MySubscriptions(offset=None): if not 'contents' in res or not len(res['contents']): return NoContents() - if 'continuations' in res: - offset = JSON.StringFromObject({ - 'itct': res['continuations'][0]['click_tracking_params'], - 'ctoken': res['continuations'][0]['continuation'], - }) - else: - offset = None - ids = [] for item in res['contents']: ids.append(item['contents'][0]['content']['items'][0]['encrypted_id']) @@ -225,15 +218,24 @@ def MySubscriptions(offset=None): extended=Prefs['my_subscriptions_extened'] ) - if offset: - oc.add(NextPageObject( - key=Callback( - MySubscriptions, - offset=offset, - ), - title=u'%s' % L('Next page'), - thumb=ICONS['next'] - )) + if 'continuations' not in res: + return oc + + # Add offset + for item in res['continuations']: + if item['item_type'] == 'next_continuation_data': + oc.add(NextPageObject( + key=Callback( + MySubscriptions, + offset=JSON.StringFromObject({ + 'itct': item['click_tracking_params'], + 'ctoken': item['continuation'], + }), + ), + title=u'%s' % L('Next page'), + thumb=ICONS['next'] + )) + break return oc diff --git a/Contents/Info.plist b/Contents/Info.plist index bbff855..486fb98 100644 --- a/Contents/Info.plist +++ b/Contents/Info.plist @@ -14,7 +14,7 @@ CFBundleSignature hook CFBundleVersion - 3.9 + 3.10 PlexPluginVersionUrl http://bit.ly/1FuE3dz