Skip to content

Commit

Permalink
Pause All/Play All when a music and a slide show are in progress -- a…
Browse files Browse the repository at this point in the history
…lso show the Image Title on the dialog screen
  • Loading branch information
ljunkie committed Sep 28, 2013
1 parent 34f57d6 commit ce2dca2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
37 changes: 21 additions & 16 deletions Plex/source/AudioPlayer.brs
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,10 @@ Function audioPlayerHandleMessage(msg) As Boolean
m.CurIndex = newIndex
else if msg.isRequestFailed() then
Debug("Audio playback failed")
Debug("Audio playback failed")
Debug("Audio playback failed")
print "failed to play song:"; msg.GetData()
print "failed to play song:"; msg.GetData()
print "failed to play song:"; msg.GetData()
print m
print m.Context.Count()
printany(6,"1",m.Context)

'maxIndex = m.Context.Count() - 1
'newIndex = m.CurIndex + 1
'if newIndex > maxIndex then newIndex = 0
'm.CurIndex = newIndex
maxIndex = m.Context.Count() - 1
newIndex = m.CurIndex + 1
if newIndex > maxIndex then newIndex = 0
m.CurIndex = newIndex
else if msg.isListItemSelected() then
Debug("Starting to play track: " + tostr(item.Url))
m.IsPlaying = true
Expand Down Expand Up @@ -229,6 +220,7 @@ Sub audioPlayerShowContextMenu()
dialog.Title = "Now Playing"
dialog.Text = firstOf(m.Context[m.CurIndex].Title, "")

' ljunkie - append current status in audio in the dialog title
append = invalid
if m.ispaused then
append = "(paused)"
Expand All @@ -239,17 +231,26 @@ Sub audioPlayerShowContextMenu()
end if
if append <> invalid then dialog.Title = dialog.Title + " " + append

' ljunkie - slideshow fun
count = m.viewcontroller.screens.count() - 1
m.slideshow = invalid
if count > 1 and type(m.viewcontroller.screens[count].screen) = "roSlideShow" then
m.slideshow = m.viewcontroller.screens[count]
if type(m.slideshow.CurIndex) = "roInteger" and type(m.slideshow.items) = "roArray" then ' ljunkie - show the photo title a slide show is in progress
dialog.Text = "Audio: " + dialog.Text + chr(10) + "Photo: " + m.slideshow.items[m.slideshow.CurIndex].textoverlayul
end if
end if

if m.IsPlaying then
dialog.SetButton("pause", "Pause")
if m.slideshow <> invalid then dialog.SetButton("pauseAll", "Pause All")
else if m.IsPaused then
dialog.SetButton("resume", "Play")
dialog.SetButton("resume", "Resume")
if m.slideshow <> invalid then dialog.SetButton("resumeAll", "Resume All")
else
dialog.SetButton("play", "Play")
end if
dialog.SetButton("stop", "Stop")
dialog.SetButton("pauseAll", "Pause All - todo")
dialog.SetButton("resumeAll", "Resume All - todo")

if m.Context.Count() > 1 then
dialog.SetButton("next_track", "Next Track")
Expand All @@ -274,10 +275,14 @@ Function audioPlayerMenuHandleButton(command, data) As Boolean
else if command = "pause" then
obj.Pause()
else if command = "pauseAll" then
' we only get here if we know we are playing a slideshow too
obj.slideshow.screen.Pause()
obj.Pause()
else if command = "resume" then
obj.Resume()
else if command = "resumeAll" then
' we only get here if we know we are playing a slideshow too
obj.slideshow.screen.Resume()
obj.Resume()
else if command = "stop" then
obj.Stop()
Expand Down
4 changes: 3 additions & 1 deletion Plex/source/PhotoPlayer.brs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Function createPhotoPlayerScreen(context, contextIndex, viewController)
obj.Screen = screen
if type(context) = "roArray" then
obj.Item = context[contextIndex]
obj.Items = context ' ljunkie - set items for access later
AddAccountHeaders(screen, obj.Item.server.AccessToken)
screen.SetContentList(context)
screen.SetNext(contextIndex, true)
Expand Down Expand Up @@ -55,7 +56,7 @@ Function photoPlayerHandleMessage(msg) As Boolean

m.ViewController.PopScreen(m)
else if msg.isPlaybackPosition() then
'm.CurIndex = msg.GetIndex()
m.CurIndex = msg.GetIndex() ' update current index
else if msg.isRequestFailed() then
Debug("preload failed: " + tostr(msg.GetIndex()))
else if msg.isRequestInterrupted() then
Expand All @@ -66,6 +67,7 @@ Function photoPlayerHandleMessage(msg) As Boolean
Debug("resumed")
else if msg.isRemoteKeyPressed() then
if msg.GetIndex() = 3 then
' this needs work -- but the options button (*) now works to show the title.. so maybe another day
ol = RegRead("slideshow_overlay_force", "preferences","0")
time = invalid
if ol = "0" then
Expand Down

0 comments on commit ce2dca2

Please sign in to comment.