Skip to content

Commit

Permalink
Update API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jellyfin-bot committed Nov 30, 2023
1 parent 03475c0 commit 490e18d
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 48 deletions.
2 changes: 1 addition & 1 deletion docs/api/data/search.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/api/module-quickplay.html

Large diffs are not rendered by default.

117 changes: 71 additions & 46 deletions docs/api/source_utils_quickplay.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,70 @@
end if
end sub

' A container with some kind of videos inside of it
sub videoContainer(itemNode as object)
print "itemNode=", itemNode
collectionType = Lcase(itemNode.collectionType)
if collectionType = "movies"
' get randomized list of videos inside
data = api.users.GetItemsByQuery(m.global.session.user.id, {
"parentId": itemNode.id,
"sortBy": "Random",
"recursive": true,
"includeItemTypes": "Movie,Video",
"limit": 2000
})
print "data=", data
if isValid(data) and isValidAndNotEmpty(data.items)
videoList = []
' add each item to the queue
for each item in data.Items
print "data.Item=", item
' only add videos we're not currently watching
if isValid(item.userdata) and isValid(item.userdata.PlaybackPositionTicks)
if item.userdata.PlaybackPositionTicks = 0
videoList.push(item)
end if
end if
end for
quickplay.pushToQueue(videoList)
else
stopLoadingSpinner()
end if
return
else if collectionType = "tvshows" or collectionType = "collectionfolder"
' get list of tv shows inside

tvshowsData = api.users.GetItemsByQuery(m.global.session.user.id, {
"parentId": itemNode.id,
"sortBy": "Random",
"recursive": true,
"excludeItemTypes": "Season",
"imageTypeLimit": 0,
"enableUserData": false,
"EnableTotalRecordCount": false,
"enableImages": false
})

print "tvshowsData=", tvshowsData

if isValid(tvshowsData) and isValidAndNotEmpty(tvshowsData.items)
' the type of media returned from api may change.
if tvshowsData.items[0].Type = "Series"
quickplay.multipleSeries(tvshowsData.items)
else
' if first item is not a series, then assume they are all videos and/or episodes
quickplay.pushToQueue(tvshowsData.items)
end if
else
stopLoadingSpinner()
end if
else
stopLoadingSpinner()
print "Quick Play videoContainer WARNING: Unknown collection type"
end if
end sub

' A TV Show Season.
' Play the first unwatched episode.
' If none, play the whole season starting with episode 1.
Expand All @@ -277,7 +341,7 @@
for each item in unwatchedData.Items
if isValid(item.UserData)
if isValid(item.UserData.Played) and item.UserData.Played = false
firstUnwatchedEpisodeIndex = item.IndexNumber - 1
firstUnwatchedEpisodeIndex = isValid(item.IndexNumber) ? item.IndexNumber - 1 : 0
if isValid(item.UserData.PlaybackPositionTicks)
item.startingPoint = item.UserData.PlaybackPositionTicks
end if
Expand Down Expand Up @@ -487,28 +551,7 @@
print "collectionType=", collectionType

if collectionType = "movies"
' get randomized list of movies inside
data = api.users.GetItemsByQuery(m.global.session.user.id, {
"parentId": itemNode.id,
"sortBy": "Random",
"limit": 2000
})

if isValid(data) and isValidAndNotEmpty(data.items)
movieList = []
' add each item to the queue
for each item in data.Items
' only add movies we're not currently watching
if isValid(item.userdata) and isValid(item.userdata.PlaybackPositionTicks)
if item.userdata.PlaybackPositionTicks = 0
movieList.push(item)
end if
end if
end for
quickplay.pushToQueue(movieList)
else
stopLoadingSpinner()
end if
quickplay.videoContainer(itemNode)
else if collectionType = "music"
' get audio files from under this collection
' sort songs by album then artist
Expand Down Expand Up @@ -560,29 +603,7 @@
end if
end if
else if collectionType = "tvshows" or collectionType = "collectionfolder"
' get list of tv shows inside
tvshowsData = api.users.GetItemsByQuery(m.global.session.user.id, {
"parentId": itemNode.id,
"sortBy": "Random",
"imageTypeLimit": 0,
"enableUserData": false,
"EnableTotalRecordCount": false,
"enableImages": false
})

print "tvshowsData=", tvshowsData

if isValid(tvshowsData) and isValidAndNotEmpty(tvshowsData.items)
' the type of media returned from api may change.
if LCase(tvshowsData.items[0].Type) = "series"
quickplay.multipleSeries(tvshowsData.items)
else
' if first item is not a series, then assume they are all videos and/or episodes
quickplay.pushToQueue(tvshowsData.items)
end if
else
stopLoadingSpinner()
end if
quickplay.videoContainer(itemNode)
else if collectionType = "musicvideos"
' get randomized list of videos inside
data = api.users.GetItemsByQuery(m.global.session.user.id, {
Expand Down Expand Up @@ -689,6 +710,10 @@
else
stopLoadingSpinner()
end if
else if collectionType = "movies"
quickplay.videoContainer(itemNode)
else if collectionType = "tvshows"
quickplay.videoContainer(itemNode)
else
stopLoadingSpinner()
print "Quick Play CollectionFolder WARNING: Unknown collection type"
Expand Down

0 comments on commit 490e18d

Please sign in to comment.