Skip to content

Commit

Permalink
- Fix second page pagination in My subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
KOL committed Dec 17, 2015
1 parent 683f50d commit 5298cd3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
40 changes: 21 additions & 19 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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'])
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<key>CFBundleSignature</key>
<string>hook</string>
<key>CFBundleVersion</key>
<string>3.9</string>
<string>3.10</string>

<key>PlexPluginVersionUrl</key>
<string>http://bit.ly/1FuE3dz</string>
Expand Down

0 comments on commit 5298cd3

Please sign in to comment.