Skip to content

Commit ff22c28

Browse files
committed
Update code docs
1 parent 6fff023 commit ff22c28

3 files changed

Lines changed: 46 additions & 46 deletions

File tree

docs/data/search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/quickplay.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/source_utils_quickplay.bs.html

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"parentId": itemNode.id,
118118
"imageTypeLimit": 1,
119119
"sortBy": "SortName",
120-
"limit": 2000,
120+
"limit": 500,
121121
"enableUserData": false,
122122
"EnableTotalRecordCount": false
123123
})
@@ -138,7 +138,7 @@
138138
"artistIds": itemNode.id,
139139
"includeItemTypes": "Audio",
140140
"sortBy": "Album",
141-
"limit": 2000,
141+
"limit": 500,
142142
"imageTypeLimit": 1,
143143
"Recursive": true,
144144
"enableUserData": false,
@@ -161,7 +161,7 @@
161161
data = api.items.GetByQuery({
162162
"userid": m.global.user.id,
163163
"parentid": itemNode.id,
164-
"limit": 2000,
164+
"limit": 500,
165165
"EnableTotalRecordCount": false
166166
})
167167
if isValid(data) and isValidAndNotEmpty(data.Items)
@@ -172,60 +172,60 @@
172172
end sub
173173

174174
' A TV Show Series.
175-
' Play the first unwatched episode.
176-
' If none, shuffle play the whole series.
175+
' Prefer an in-progress (resumable) episode — consistent with the Continue Watching row.
176+
' Falls back to the next unstarted/unwatched episode (ep 1 for a fresh series).
177+
' If all episodes are fully watched and rewatching is disabled, shuffle the whole series.
177178
sub series(itemNode as object)
178179
if not isValid(itemNode) or not isValid(itemNode.id) then return
179180

180181
' ONE rendezvous to get user
181182
localUser = m.global.user
182183

183-
data = api.shows.GetNextUp({
184-
"seriesId": itemNode.id,
185-
"recursive": true,
184+
' Check for a resumable (in-progress) episode first
185+
resumeData = api.users.GetResumeItemsByQuery(localUser.id, {
186+
"parentId": itemNode.id,
187+
"userid": localUser.id,
188+
"Filters": "IsResumable",
186189
"SortBy": "DatePlayed",
187190
"SortOrder": "Descending",
191+
"Limit": 1,
192+
"recursive": true,
188193
"ImageTypeLimit": 1,
189-
"UserId": localUser.id,
190-
"EnableRewatching": localUser.settings.uiDetailsEnableRewatchingNextUp,
191-
"DisableFirstEpisode": false,
192194
"EnableTotalRecordCount": false
193195
})
194196

195-
if isValid(data) and isValidAndNotEmpty(data.Items)
196-
' there are unwatched episodes
197-
m.global.queueManager.callFunc("push", nodeHelpers.createQueueItem(data.Items[0]))
197+
if isValid(resumeData) and isValidAndNotEmpty(resumeData.Items)
198+
' play the resumable episode
199+
queueItem = nodeHelpers.createQueueItem(resumeData.Items[0])
200+
if isValid(resumeData.Items[0].UserData) and isValid(resumeData.Items[0].UserData.PlaybackPositionTicks)
201+
queueItem.startingPoint = resumeData.Items[0].UserData.PlaybackPositionTicks
202+
end if
203+
m.global.queueManager.callFunc("push", queueItem)
198204
else
199-
' next up check was empty
200-
' check for a resumable episode
201-
data = api.users.GetResumeItemsByQuery(localUser.id, {
202-
"parentId": itemNode.id,
203-
"userid": localUser.id,
204-
"SortBy": "DatePlayed",
205-
"recursive": true,
206-
"SortOrder": "Descending",
207-
"Filters": "IsResumable",
205+
' Fall back to next unstarted episode.
206+
' DisableFirstEpisode: false so a completely unwatched series starts at episode 1.
207+
data = api.shows.GetNextUp({
208+
"seriesId": itemNode.id,
209+
"UserId": localUser.id,
210+
"Limit": 1,
211+
"DisableFirstEpisode": false,
212+
"ImageTypeLimit": 1,
213+
"EnableRewatching": localUser.settings.uiDetailsEnableRewatchingNextUp,
208214
"EnableTotalRecordCount": false
209215
})
210-
print "resumeitems data=", data
216+
211217
if isValid(data) and isValidAndNotEmpty(data.Items)
212-
' play the resumable episode
213-
queueItem = nodeHelpers.createQueueItem(data.Items[0])
214-
if isValid(data.Items[0].UserData) and isValid(data.Items[0].UserData.PlaybackPositionTicks)
215-
queueItem.startingPoint = data.Items[0].UserData.PlaybackPositionTicks
216-
end if
217-
m.global.queueManager.callFunc("push", queueItem)
218+
m.global.queueManager.callFunc("push", nodeHelpers.createQueueItem(data.Items[0]))
218219
else
219-
' shuffle all episodes
220+
' All episodes fully watched and rewatching disabled — shuffle the whole series
220221
data = api.shows.GetEpisodes(itemNode.id, {
221222
"userid": localUser.id,
222223
"SortBy": "Random",
223-
"limit": 2000,
224+
"limit": 500,
224225
"EnableTotalRecordCount": false
225226
})
226227

227228
if isValid(data) and isValidAndNotEmpty(data.Items)
228-
' add all episodes found to a playlist
229229
quickplay.pushToQueue(data.Items)
230230
else
231231
stopLoadingSpinner()
@@ -242,7 +242,7 @@
242242
userId = m.global.user.id
243243

244244
numTotal = 0
245-
numLimit = 2000
245+
numLimit = 500
246246
for each tvshow in itemNodes
247247
' grab all watched episodes for each series
248248
showData = api.shows.GetEpisodes(tvshow.id, {
@@ -292,7 +292,7 @@
292292
"sortBy": "Random",
293293
"recursive": true,
294294
"includeItemTypes": "Movie,Video",
295-
"limit": 2000
295+
"limit": 500
296296
})
297297
print "data=", data
298298
if isValid(data) and isValidAndNotEmpty(data.items)
@@ -357,7 +357,7 @@
357357
unwatchedData = api.shows.GetEpisodes(seriesId, {
358358
"seasonId": itemNode.id,
359359
"userid": globalUser.id,
360-
"limit": 2000,
360+
"limit": 500,
361361
"EnableTotalRecordCount": false
362362
})
363363

@@ -429,7 +429,7 @@
429429
"includeItemTypes": "Movie,Video",
430430
"excludeItemTypes": "Season,Series",
431431
"recursive": true,
432-
"limit": 2000
432+
"limit": 500
433433
})
434434
print "personMovies=", personMovies
435435

@@ -445,7 +445,7 @@
445445
"isPlayed": true,
446446
"excludeItemTypes": "Season,Series",
447447
"recursive": true,
448-
"limit": 2000
448+
"limit": 500
449449
})
450450
print "personEpisodes=", personEpisodes
451451

@@ -498,7 +498,7 @@
498498
' get playlist items
499499
myPlaylist = api.playlists.GetItems(itemNode.id, {
500500
"userId": m.global.user.id,
501-
"limit": 2000
501+
"limit": 500
502502
})
503503

504504
if isValid(myPlaylist) and isValidAndNotEmpty(myPlaylist.Items)
@@ -521,7 +521,7 @@
521521
"includeItemTypes": ["Episode", "Recording", "Movie", "Video"],
522522
"videoTypes": "VideoFile",
523523
"sortBy": "Random",
524-
"limit": 2000,
524+
"limit": 500,
525525
"imageTypeLimit": 1,
526526
"Recursive": true,
527527
"enableUserData": false,
@@ -605,7 +605,7 @@
605605
"includeItemTypes": "Audio",
606606
"sortBy": "Album",
607607
"Recursive": true,
608-
"limit": 2000,
608+
"limit": 500,
609609
"imageTypeLimit": 1,
610610
"enableUserData": false,
611611
"EnableTotalRecordCount": false
@@ -620,7 +620,7 @@
620620
' get list of all boxsets inside
621621
boxsetData = api.users.GetItemsByQuery(globalUser.id, {
622622
"parentId": itemNode.id,
623-
"limit": 2000,
623+
"limit": 500,
624624
"imageTypeLimit": 0,
625625
"enableUserData": false,
626626
"EnableTotalRecordCount": false,
@@ -656,7 +656,7 @@
656656
"includeItemTypes": "MusicVideo",
657657
"sortBy": "Random",
658658
"Recursive": true,
659-
"limit": 2000,
659+
"limit": 500,
660660
"imageTypeLimit": 1,
661661
"enableUserData": false,
662662
"EnableTotalRecordCount": false
@@ -724,7 +724,7 @@
724724
playlistItems = api.playlists.GetItems(myPlaylist.id, {
725725
"userId": globalUser.id,
726726
"EnableTotalRecordCount": false,
727-
"limit": 2000
727+
"limit": 500
728728
})
729729
' validate api results
730730
if isValid(playlistItems) and isValidAndNotEmpty(playlistItems.items)

0 commit comments

Comments
 (0)