Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Play Next Episode Automatically user setting #1881

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions components/ItemGrid/LoadVideoContentTask.bs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
video.logoImage = api.items.GetImageURL(logoLookupID, "logo", 0, { "maxHeight": 65, "maxWidth": 300, "quality": "90" })
end if

if m.global.session.user.Configuration.EnableNextEpisodeAutoPlay
if LCase(m.top.itemType) = "episode"
if LCase(m.top.itemType) = "episode"
userSession = m.global.session.user
if userSession.settings["playback.playnextepisode"] = "enabled" or userSession.settings["playback.playnextepisode"] = "webclient" and userSession.Configuration.EnableNextEpisodeAutoPlay
addNextEpisodesToQueue(video.showID)
end if
end if
Expand Down
14 changes: 8 additions & 6 deletions components/JFVideo.bs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ end sub
sub showNextEpisodeButton()
if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode"
if m.nextupbuttonseconds = 0 then return ' is the button disabled?

if m.nextEpisodeButton.opacity = 0 and m.global.session.user.configuration.EnableNextEpisodeAutoPlay
m.nextEpisodeButton.visible = true
m.showNextEpisodeButtonAnimation.control = "start"
m.nextEpisodeButton.setFocus(true)
end if
if m.nextEpisodeButton.opacity <> 0 then return
userSession = m.global.session.user
if userSession.settings["playback.playnextepisode"] = "disabled" then return
if userSession.settings["playback.playnextepisode"] = "webclient" and not userSession.Configuration.EnableNextEpisodeAutoPlay then return

m.nextEpisodeButton.visible = true
m.showNextEpisodeButtonAnimation.control = "start"
m.nextEpisodeButton.setFocus(true)
end sub

'
Expand Down
14 changes: 8 additions & 6 deletions components/video/VideoPlayerView.bs
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,14 @@ sub showNextEpisodeButton()
if m.osd.visible then return
if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode"
if m.nextupbuttonseconds = 0 then return ' is the button disabled?

if m.nextEpisodeButton.opacity = 0 and m.global.session.user.configuration.EnableNextEpisodeAutoPlay
m.nextEpisodeButton.visible = true
m.showNextEpisodeButtonAnimation.control = "start"
m.nextEpisodeButton.setFocus(true)
end if
if m.nextEpisodeButton.opacity <> 0 then return
userSession = m.global.session.user
if userSession.settings["playback.playnextepisode"] = "disabled" then return
if userSession.settings["playback.playnextepisode"] = "webclient" and not userSession.Configuration.EnableNextEpisodeAutoPlay then return

m.nextEpisodeButton.visible = true
m.showNextEpisodeButtonAnimation.control = "start"
m.nextEpisodeButton.setFocus(true)
end sub

'
Expand Down
10 changes: 10 additions & 0 deletions locale/en_US/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,16 @@
<translation>Show already watched episodes in 'Next Up' sections.</translation>
<extracomment>User Setting - Setting description</extracomment>
</message>
<message>
<source>Play Next Episode Automatically</source>
<translation>Play Next Episode Automatically</translation>
<extracomment>User Setting - Setting title</extracomment>
</message>
<message>
<source>When finished playing a single episode, play the next one automatically.</source>
<translation>When finished playing a single episode, play the next one automatically.</translation>
<extracomment>User Setting - Setting description</extracomment>
</message>
<message>
<source>Episode Images Next Up</source>
<translation>Episode Images Next Up</translation>
Expand Down
21 changes: 21 additions & 0 deletions settings/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,27 @@
"type": "integer",
"default": "30"
},
{
"title": "Play Next Episode Automatically",
"description": "When finished playing a single episode, play the next one automatically.",
"settingName": "playback.playnextepisode",
"type": "radio",
"default": "webclient",
"options": [
{
"title": "Use Web Client Setting",
"id": "webclient"
},
{
"title": "Enabled",
"id": "enabled"
},
{
"title": "Disabled",
"id": "disabled"
}
]
},
{
"title": "Preferred Audio Codec",
"description": "Use the selected audio codec for transcodes. If the device or stream does not support it, a fallback codec will be used.",
Expand Down
6 changes: 3 additions & 3 deletions source/VideoPlayer.bs
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,11 @@ function getAudioInfo(meta as object) as object
end function

sub autoPlayNextEpisode(videoID as string, showID as string)
' use web client setting
if m.global.session.user.configuration.EnableNextEpisodeAutoPlay
userSession = m.global.session.user
if userSession.settings["playback.playnextepisode"] = "enabled" or userSession.settings["playback.playnextepisode"] = "webclient" and userSession.Configuration.EnableNextEpisodeAutoPlay
' query API for next episode ID
url = Substitute("Shows/{0}/Episodes", showID)
urlParams = { "UserId": m.global.session.user.id }
urlParams = { "UserId": userSession.id }
urlParams.Append({ "StartItemId": videoID })
urlParams.Append({ "Limit": 2 })
resp = APIRequest(url, urlParams)
Expand Down
Loading