Merge pull request #871 from 1hitsong/additionalPartResume
Fix lockup on Additional Parts resume
This commit is contained in:
commit
cc8d74d51d
|
@ -145,7 +145,12 @@ sub Main (args as dynamic) as void
|
|||
dialog.title = tr("Loading Channel Data")
|
||||
m.scene.dialog = dialog
|
||||
|
||||
video = CreateVideoPlayerGroup(video_id)
|
||||
if LCase(selectedItem.subtype()) = "extrasdata"
|
||||
video = CreateVideoPlayerGroup(video_id, invalid, 1, false, true, false)
|
||||
else
|
||||
video = CreateVideoPlayerGroup(video_id)
|
||||
end if
|
||||
|
||||
dialog.close = true
|
||||
|
||||
if video <> invalid and video.errorMsg <> "introaborted"
|
||||
|
|
|
@ -498,10 +498,10 @@ sub CreateSidePanel(buttons, options)
|
|||
group.options = options
|
||||
end sub
|
||||
|
||||
function CreateVideoPlayerGroup(video_id, mediaSourceId = invalid, audio_stream_idx = 1, forceTranscoding = false, showIntro = true)
|
||||
function CreateVideoPlayerGroup(video_id, mediaSourceId = invalid, audio_stream_idx = 1, forceTranscoding = false, showIntro = true, allowResumeDialog = true)
|
||||
|
||||
' Video is Playing
|
||||
video = VideoPlayer(video_id, mediaSourceId, audio_stream_idx, defaultSubtitleTrackFromVid(video_id), forceTranscoding, showIntro)
|
||||
video = VideoPlayer(video_id, mediaSourceId, audio_stream_idx, defaultSubtitleTrackFromVid(video_id), forceTranscoding, showIntro, allowResumeDialog)
|
||||
|
||||
if video = invalid then return invalid
|
||||
if video.errorMsg = "introaborted" then return video
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
function VideoPlayer(id, mediaSourceId = invalid, audio_stream_idx = 1, subtitle_idx = -1, forceTranscoding = false, showIntro = true)
|
||||
function VideoPlayer(id, mediaSourceId = invalid, audio_stream_idx = 1, subtitle_idx = -1, forceTranscoding = false, showIntro = true, allowResumeDialog = true)
|
||||
' Get video controls and UI
|
||||
video = CreateObject("roSGNode", "JFVideo")
|
||||
video.id = id
|
||||
AddVideoContent(video, mediaSourceId, audio_stream_idx, subtitle_idx, -1, forceTranscoding, showIntro)
|
||||
AddVideoContent(video, mediaSourceId, audio_stream_idx, subtitle_idx, -1, forceTranscoding, showIntro, allowResumeDialog)
|
||||
|
||||
if video.errorMsg = "introaborted"
|
||||
return video
|
||||
|
@ -19,7 +19,7 @@ function VideoPlayer(id, mediaSourceId = invalid, audio_stream_idx = 1, subtitle
|
|||
return video
|
||||
end function
|
||||
|
||||
sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = -1, playbackPosition = -1, forceTranscoding = false, showIntro = true)
|
||||
sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = -1, playbackPosition = -1, forceTranscoding = false, showIntro = true, allowResumeDialog = true)
|
||||
video.content = createObject("RoSGNode", "ContentNode")
|
||||
meta = ItemMetaData(video.id)
|
||||
m.videotype = meta.type
|
||||
|
@ -55,103 +55,105 @@ sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = -
|
|||
|
||||
if playbackPosition = -1
|
||||
playbackPosition = meta.json.UserData.PlaybackPositionTicks
|
||||
if playbackPosition > 0
|
||||
dialogResult = startPlayBackOver(playbackPosition)
|
||||
'Dialog returns -1 when back pressed, 0 for resume, and 1 for start over
|
||||
if dialogResult = -1
|
||||
'User pressed back, return invalid and don't load video
|
||||
video.content = invalid
|
||||
return
|
||||
else if dialogResult = 1
|
||||
'Start Over selected, change position to 0
|
||||
playbackPosition = 0
|
||||
else if dialogResult = 2
|
||||
'Mark this item as watched, refresh the page, and return invalid so we don't load the video
|
||||
MarkItemWatched(video.id)
|
||||
video.content.watched = not video.content.watched
|
||||
group = m.scene.focusedChild
|
||||
group.timeLastRefresh = CreateObject("roDateTime").AsSeconds()
|
||||
group.callFunc("refresh")
|
||||
video.content = invalid
|
||||
return
|
||||
else if dialogResult = 3
|
||||
'get series ID based off episiode ID
|
||||
params = {
|
||||
ids: video.Id
|
||||
}
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
for each item in data.Items
|
||||
m.series_id = item.SeriesId
|
||||
end for
|
||||
'Get series json data
|
||||
params = {
|
||||
ids: m.series_id
|
||||
}
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
for each item in data.Items
|
||||
m.tmp = item
|
||||
end for
|
||||
'Create Series Scene
|
||||
CreateSeriesDetailsGroup(m.tmp)
|
||||
video.content = invalid
|
||||
return
|
||||
if allowResumeDialog
|
||||
if playbackPosition > 0
|
||||
dialogResult = startPlayBackOver(playbackPosition)
|
||||
'Dialog returns -1 when back pressed, 0 for resume, and 1 for start over
|
||||
if dialogResult = -1
|
||||
'User pressed back, return invalid and don't load video
|
||||
video.content = invalid
|
||||
return
|
||||
else if dialogResult = 1
|
||||
'Start Over selected, change position to 0
|
||||
playbackPosition = 0
|
||||
else if dialogResult = 2
|
||||
'Mark this item as watched, refresh the page, and return invalid so we don't load the video
|
||||
MarkItemWatched(video.id)
|
||||
video.content.watched = not video.content.watched
|
||||
group = m.scene.focusedChild
|
||||
group.timeLastRefresh = CreateObject("roDateTime").AsSeconds()
|
||||
group.callFunc("refresh")
|
||||
video.content = invalid
|
||||
return
|
||||
else if dialogResult = 3
|
||||
'get series ID based off episiode ID
|
||||
params = {
|
||||
ids: video.Id
|
||||
}
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
for each item in data.Items
|
||||
m.series_id = item.SeriesId
|
||||
end for
|
||||
'Get series json data
|
||||
params = {
|
||||
ids: m.series_id
|
||||
}
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
for each item in data.Items
|
||||
m.tmp = item
|
||||
end for
|
||||
'Create Series Scene
|
||||
CreateSeriesDetailsGroup(m.tmp)
|
||||
video.content = invalid
|
||||
return
|
||||
|
||||
else if dialogResult = 4
|
||||
'get Season/Series ID based off episiode ID
|
||||
params = {
|
||||
ids: video.Id
|
||||
}
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
for each item in data.Items
|
||||
m.season_id = item.SeasonId
|
||||
m.series_id = item.SeriesId
|
||||
end for
|
||||
'Get Series json data
|
||||
params = {
|
||||
ids: m.season_id
|
||||
}
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
for each item in data.Items
|
||||
m.Season_tmp = item
|
||||
end for
|
||||
'Get Season json data
|
||||
params = {
|
||||
ids: m.series_id
|
||||
}
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
for each item in data.Items
|
||||
m.Series_tmp = item
|
||||
end for
|
||||
'Create Season Scene
|
||||
CreateSeasonDetailsGroup(m.Series_tmp, m.Season_tmp)
|
||||
video.content = invalid
|
||||
return
|
||||
else if dialogResult = 4
|
||||
'get Season/Series ID based off episiode ID
|
||||
params = {
|
||||
ids: video.Id
|
||||
}
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
for each item in data.Items
|
||||
m.season_id = item.SeasonId
|
||||
m.series_id = item.SeriesId
|
||||
end for
|
||||
'Get Series json data
|
||||
params = {
|
||||
ids: m.season_id
|
||||
}
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
for each item in data.Items
|
||||
m.Season_tmp = item
|
||||
end for
|
||||
'Get Season json data
|
||||
params = {
|
||||
ids: m.series_id
|
||||
}
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
for each item in data.Items
|
||||
m.Series_tmp = item
|
||||
end for
|
||||
'Create Season Scene
|
||||
CreateSeasonDetailsGroup(m.Series_tmp, m.Season_tmp)
|
||||
video.content = invalid
|
||||
return
|
||||
|
||||
else if dialogResult = 5
|
||||
'get episiode ID
|
||||
params = {
|
||||
ids: video.Id
|
||||
}
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
for each item in data.Items
|
||||
m.episode_id = item
|
||||
end for
|
||||
'Create Episode Scene
|
||||
CreateMovieDetailsGroup(m.episode_id)
|
||||
video.content = invalid
|
||||
return
|
||||
else if dialogResult = 5
|
||||
'get episiode ID
|
||||
params = {
|
||||
ids: video.Id
|
||||
}
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
for each item in data.Items
|
||||
m.episode_id = item
|
||||
end for
|
||||
'Create Episode Scene
|
||||
CreateMovieDetailsGroup(m.episode_id)
|
||||
video.content = invalid
|
||||
return
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
|
Loading…
Reference in New Issue
Block a user