|
117 | 117 | "parentId": itemNode.id, |
118 | 118 | "imageTypeLimit": 1, |
119 | 119 | "sortBy": "SortName", |
120 | | - "limit": 2000, |
| 120 | + "limit": 500, |
121 | 121 | "enableUserData": false, |
122 | 122 | "EnableTotalRecordCount": false |
123 | 123 | }) |
|
138 | 138 | "artistIds": itemNode.id, |
139 | 139 | "includeItemTypes": "Audio", |
140 | 140 | "sortBy": "Album", |
141 | | - "limit": 2000, |
| 141 | + "limit": 500, |
142 | 142 | "imageTypeLimit": 1, |
143 | 143 | "Recursive": true, |
144 | 144 | "enableUserData": false, |
|
161 | 161 | data = api.items.GetByQuery({ |
162 | 162 | "userid": m.global.user.id, |
163 | 163 | "parentid": itemNode.id, |
164 | | - "limit": 2000, |
| 164 | + "limit": 500, |
165 | 165 | "EnableTotalRecordCount": false |
166 | 166 | }) |
167 | 167 | if isValid(data) and isValidAndNotEmpty(data.Items) |
|
172 | 172 | end sub |
173 | 173 |
|
174 | 174 | ' 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. |
177 | 178 | sub series(itemNode as object) |
178 | 179 | if not isValid(itemNode) or not isValid(itemNode.id) then return |
179 | 180 |
|
180 | 181 | ' ONE rendezvous to get user |
181 | 182 | localUser = m.global.user |
182 | 183 |
|
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", |
186 | 189 | "SortBy": "DatePlayed", |
187 | 190 | "SortOrder": "Descending", |
| 191 | + "Limit": 1, |
| 192 | + "recursive": true, |
188 | 193 | "ImageTypeLimit": 1, |
189 | | - "UserId": localUser.id, |
190 | | - "EnableRewatching": localUser.settings.uiDetailsEnableRewatchingNextUp, |
191 | | - "DisableFirstEpisode": false, |
192 | 194 | "EnableTotalRecordCount": false |
193 | 195 | }) |
194 | 196 |
|
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) |
198 | 204 | 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, |
208 | 214 | "EnableTotalRecordCount": false |
209 | 215 | }) |
210 | | - print "resumeitems data=", data |
| 216 | + |
211 | 217 | 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])) |
218 | 219 | else |
219 | | - ' shuffle all episodes |
| 220 | + ' All episodes fully watched and rewatching disabled — shuffle the whole series |
220 | 221 | data = api.shows.GetEpisodes(itemNode.id, { |
221 | 222 | "userid": localUser.id, |
222 | 223 | "SortBy": "Random", |
223 | | - "limit": 2000, |
| 224 | + "limit": 500, |
224 | 225 | "EnableTotalRecordCount": false |
225 | 226 | }) |
226 | 227 |
|
227 | 228 | if isValid(data) and isValidAndNotEmpty(data.Items) |
228 | | - ' add all episodes found to a playlist |
229 | 229 | quickplay.pushToQueue(data.Items) |
230 | 230 | else |
231 | 231 | stopLoadingSpinner() |
|
242 | 242 | userId = m.global.user.id |
243 | 243 |
|
244 | 244 | numTotal = 0 |
245 | | - numLimit = 2000 |
| 245 | + numLimit = 500 |
246 | 246 | for each tvshow in itemNodes |
247 | 247 | ' grab all watched episodes for each series |
248 | 248 | showData = api.shows.GetEpisodes(tvshow.id, { |
|
292 | 292 | "sortBy": "Random", |
293 | 293 | "recursive": true, |
294 | 294 | "includeItemTypes": "Movie,Video", |
295 | | - "limit": 2000 |
| 295 | + "limit": 500 |
296 | 296 | }) |
297 | 297 | print "data=", data |
298 | 298 | if isValid(data) and isValidAndNotEmpty(data.items) |
|
357 | 357 | unwatchedData = api.shows.GetEpisodes(seriesId, { |
358 | 358 | "seasonId": itemNode.id, |
359 | 359 | "userid": globalUser.id, |
360 | | - "limit": 2000, |
| 360 | + "limit": 500, |
361 | 361 | "EnableTotalRecordCount": false |
362 | 362 | }) |
363 | 363 |
|
|
429 | 429 | "includeItemTypes": "Movie,Video", |
430 | 430 | "excludeItemTypes": "Season,Series", |
431 | 431 | "recursive": true, |
432 | | - "limit": 2000 |
| 432 | + "limit": 500 |
433 | 433 | }) |
434 | 434 | print "personMovies=", personMovies |
435 | 435 |
|
|
445 | 445 | "isPlayed": true, |
446 | 446 | "excludeItemTypes": "Season,Series", |
447 | 447 | "recursive": true, |
448 | | - "limit": 2000 |
| 448 | + "limit": 500 |
449 | 449 | }) |
450 | 450 | print "personEpisodes=", personEpisodes |
451 | 451 |
|
|
498 | 498 | ' get playlist items |
499 | 499 | myPlaylist = api.playlists.GetItems(itemNode.id, { |
500 | 500 | "userId": m.global.user.id, |
501 | | - "limit": 2000 |
| 501 | + "limit": 500 |
502 | 502 | }) |
503 | 503 |
|
504 | 504 | if isValid(myPlaylist) and isValidAndNotEmpty(myPlaylist.Items) |
|
521 | 521 | "includeItemTypes": ["Episode", "Recording", "Movie", "Video"], |
522 | 522 | "videoTypes": "VideoFile", |
523 | 523 | "sortBy": "Random", |
524 | | - "limit": 2000, |
| 524 | + "limit": 500, |
525 | 525 | "imageTypeLimit": 1, |
526 | 526 | "Recursive": true, |
527 | 527 | "enableUserData": false, |
|
605 | 605 | "includeItemTypes": "Audio", |
606 | 606 | "sortBy": "Album", |
607 | 607 | "Recursive": true, |
608 | | - "limit": 2000, |
| 608 | + "limit": 500, |
609 | 609 | "imageTypeLimit": 1, |
610 | 610 | "enableUserData": false, |
611 | 611 | "EnableTotalRecordCount": false |
|
620 | 620 | ' get list of all boxsets inside |
621 | 621 | boxsetData = api.users.GetItemsByQuery(globalUser.id, { |
622 | 622 | "parentId": itemNode.id, |
623 | | - "limit": 2000, |
| 623 | + "limit": 500, |
624 | 624 | "imageTypeLimit": 0, |
625 | 625 | "enableUserData": false, |
626 | 626 | "EnableTotalRecordCount": false, |
|
656 | 656 | "includeItemTypes": "MusicVideo", |
657 | 657 | "sortBy": "Random", |
658 | 658 | "Recursive": true, |
659 | | - "limit": 2000, |
| 659 | + "limit": 500, |
660 | 660 | "imageTypeLimit": 1, |
661 | 661 | "enableUserData": false, |
662 | 662 | "EnableTotalRecordCount": false |
|
724 | 724 | playlistItems = api.playlists.GetItems(myPlaylist.id, { |
725 | 725 | "userId": globalUser.id, |
726 | 726 | "EnableTotalRecordCount": false, |
727 | | - "limit": 2000 |
| 727 | + "limit": 500 |
728 | 728 | }) |
729 | 729 | ' validate api results |
730 | 730 | if isValid(playlistItems) and isValidAndNotEmpty(playlistItems.items) |
|
0 commit comments