Skip to content

Commit

Permalink
Merge pull request #216 from chtaylo2/development
Browse files Browse the repository at this point in the history
Release v3.2
  • Loading branch information
chtaylo2 authored Apr 19, 2019
2 parents 7d99f81 + ad62088 commit c47d0c1
Show file tree
Hide file tree
Showing 16 changed files with 280 additions and 73 deletions.
6 changes: 5 additions & 1 deletion components/AuthLinking/Registration.brs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ End Sub
Sub onCheckAuth(event as object)
print "Registration.brs [onCheckAuth]"
status = -1 ' 0 => Finished (got tokens), < 0 => Retry needed, > 0 => fatal error


'Stop the screensaver from starting
m.keyResetTask = createObject("roSGNode", "KeyReset")
m.keyResetTask.control = "RUN"

errorMsg = ""
pollData = m.UriHandler.poll_token_response

Expand Down
9 changes: 5 additions & 4 deletions components/InfoPopup/InfoPopup.brs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ End Sub
Sub setFeaturesText()

m.itemLabelHeader.text = "New Channel Features"
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + "1. Major re-write, moving to Googles Photos new API. We're now an offical 'Google Photos Partner'"
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + "1. Major re-write, moving to Google Photos new API. We're now an offical 'Google Photos Partner'"
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + "2. Introducing 'This Time in History' playback. See the new Dynamic Albums option."
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + "3. TIP: Screensaver can show specific albums. See 'Linked Users' in screensaver options."
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + "3. Usage Optimizations"
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + chr(10) + "Bug fixes:"
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + " - Empty albums caused error in screensaver"
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + " - Screensaver album selection crash"
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + " - Addressing Google API change, removing account name"
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + " - Other minor bugs"
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + chr(10) + "Thank you for using the PhotoView Channel."

Expand All @@ -71,7 +72,7 @@ End Sub
Sub setAboutText()

m.itemLabelHeader.text = "About Channel"
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + "The 'PhotoView for Google Photos' channel was developed by Chris Taylor. It's dedicated to his 3-year-old daughter, who goes nuts every time she herself on TV."
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + "The 'PhotoView for Google Photos' channel was developed by Chris Taylor. It's dedicated to his 3-year-old daughter, who goes nuts every time she sees herself on TV."
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + chr(10) + "We're committed to making this one of the best Photo Apps on the Roku platform."
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + chr(10) + "If you have any questions or comments, please see [Tips and Tricks > Bugs / Feature Request]"
m.itemLabelMain.text = m.itemLabelMain.text + chr(10) + chr(10) + "Please remember to rate us, this helps spread the word and drive development!"
Expand Down
7 changes: 5 additions & 2 deletions components/MainMenu/MainMenu.brs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Sub init()
' Load in the OAuth Registry entries
loadReg()

'Load common variables
loadCommon()

'Define SG nodes
m.markupgrid = m.top.findNode("homeGrid")
m.itemLabelMain1 = m.top.findNode("itemLabelMain1")
Expand All @@ -30,7 +33,7 @@ Sub init()
m.readMarkupGridTask.observeField("content", "showmarkupgrid")
m.readMarkupGridTask.control = "RUN"

makeRequest({}, "https://www.roku-photoview.com/status/roku_status_v3.xml" + "?" + getRandomString(10), "GET", "", 7, [])
makeRequest({}, "https://www.roku-photoview.com/status/roku_status_v" + m.releaseVersion + ".xml" + "?" + getRandomString(10), "GET", "", 7, [])

End Sub

Expand Down Expand Up @@ -93,7 +96,7 @@ Sub onItemSelected()
m.noticeDialog.visible = true
buttons = [ "OK" ]
m.noticeDialog.title = "Notice"
m.noticeDialog.message = "Google Photos new API does not currently have image searching available. A feature request is opened and hope to then have this re-enabled soon."
m.noticeDialog.message = "Google Photos new API does not currently have image searching available. A feature request is opened with Google and hope to have this re-enabled soon."
m.noticeDialog.buttons = buttons
m.noticeDialog.setFocus(true)
m.noticeDialog.observeField("buttonSelected","noticeClose")
Expand Down
2 changes: 1 addition & 1 deletion components/Screensaver/Screensaver.brs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ Sub onApiTimerTrigger()
print "API CALLS LEFT: "; m.apiPending; " - Image Count: "; m.photoItems.Count()

if m.apiPending = 0 then
if m.albumActiveObject.Count() = 0 then
if (m.albumActiveObject.Count() = 0) and (m.userCount <> 0) then
processAlbums()
else
execScreensaver()
Expand Down
8 changes: 4 additions & 4 deletions components/Settings/Settings.brs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Sub doGetAlbumSelection(pageNext="" As String)

if selectedUser <> usersLoaded then
m.loadingSpinner.visible = true
m.infoLabel.text = m.infoLabel.text + chr(10) + chr(10) + "Current user selected: " + m.userInfoName[selectedUser]
m.infoLabel.text = m.infoLabel.text + chr(10) + chr(10) + "Current user selected: " + m.userInfoEmail[selectedUser]
doGetAlbumList(selectedUser, pageNext)

else
Expand Down Expand Up @@ -187,7 +187,7 @@ Sub printAlbumSelection(albumList As Object)
parsedString = regAlbums.Split("|")
for each item in parsedString
albumUser = item.Split(":")
if (albumUser[0] = "GP_LIBRARY") and (albumUser[1] = response.post_data[1].Tostr()) then
if (albumUser[0] = "GP_LIBRARY") then
'Check selected album
saved = 1
end if
Expand Down Expand Up @@ -414,7 +414,7 @@ Sub storeLinkedUsers()
addItem(m.content, "No users linked", "0", "")
else
for i = 0 to usersLoaded-1
addItem(m.content, m.userInfoName[i] + " - (" + m.userInfoEmail[i] + ")", m.userInfoEmail[i], regStore)
addItem(m.content, m.userInfoEmail[i], m.userInfoEmail[i], regStore)
if regSelection = m.userInfoEmail[i] then radioSelection = i
end for
if usersLoaded > 1 then
Expand Down Expand Up @@ -526,7 +526,7 @@ Sub showselected()
'UNREGISTER USER
m.confirmDialog.visible = true
buttons = [ "Confirm", "Cancel" ]
m.confirmDialog.message = "Are you sure you want to unregister " + m.userInfoName[m.global.selectedUser] + " from this device?"
m.confirmDialog.message = "Are you sure you want to unregister " + m.userInfoEmail[m.global.selectedUser] + " from this device?"
m.confirmDialog.buttons = buttons
m.confirmDialog.setFocus(true)
end if
Expand Down
14 changes: 4 additions & 10 deletions components/Slideshow/Albums/Albums.brs
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,11 @@ Sub onItemSelected()
m.itemLabelMain2.text = m.albumName
m.itemLabelMain3.text = ""

if m.albumActiveObject[albumid].GetImageCount > 1000 then
lastPopup = RegRead("ThousandPopup","Settings")
if (lastPopup=invalid or lastPopup<>"v3.0true") then showThousandPopup()
else

'Display Loading Spinner
showLoadingSpinner(3, "GP_LOADING")
'Display Loading Spinner
showLoadingSpinner(3, "GP_LOADING")

'API CALL: Get album image listing
doGetAlbumImages(albumid, m.global.selectedUser)
end if
'API CALL: Get album image listing
doGetAlbumImages(albumid, m.global.selectedUser)

else if selection.id = "GP_PULL_NEXT" then
print "GP_PULL_NEXT"
Expand Down
153 changes: 135 additions & 18 deletions components/Slideshow/Browse/Browse.brs
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,146 @@ Sub init()
m.itemLabelMain1 = m.top.findNode("itemLabelMain1")
m.itemLabelMain2 = m.top.findNode("itemLabelMain2")
m.settingsIcon = m.top.findNode("settingsIcon")
m.mediaPageList = m.top.findNode("mediaPageList")
m.mediaPageThumb = m.top.findNode("mediaPageThumb")
m.mediaPageInfo1 = m.top.findNode("mediaPageInfo1")
m.mediaPageInfo2 = m.top.findNode("mediaPageInfo2")

m.VideoPlayer = m.top.findNode("VideoPlayer")

m.regStore = "positions"
m.regSection = "VideoStatus"

m.itemLabelMain2.font.size = 25
m.videoPlayingindex = 0
m.pageSelected = 0
m.itemsPerPage = 100
m.itemsStart = 0
m.itemsEnd = 0

m.showVideoPlayback = RegRead("VideoContinuePlay", "Settings")

m.top.observeField("content","loadImageList")
m.top.observeField("content","loadPageList")
End Sub


Sub loadPageList()
print "Browse.brs [loadPageList]"

m.metaData = m.top.metaData
m.mediaPages = createObject("RoSGNode","ContentNode")
totalPages = m.metaData.Count() / m.itemsPerPage
currentCount = m.metaData.Count()
page_start = 0
page_end = 0

if (ceiling(totalPages) = 1) then
buildMediaList(0)
else
for i = 1 to ceiling(totalPages)
page_start = 1 + page_end
if currentCount > m.itemsPerPage then
page_end=page_end + m.itemsPerPage
currentCount = currentCount - m.itemsPerPage
else
page_end=page_end + currentCount
end if

page_start_dply = str(page_start)
page_start_dply = page_start_dply.Replace(" ", "")

page_end_dply = str(page_end)
page_end_dply = page_end_dply.Replace(" ", "")

addItem(m.mediaPages, "GP_MEDIA_PAGES", "", "Media Page " + str(i), "Items: "+page_start_dply+" thru "+page_end_dply)
end for

m.mediaPageList.content = m.mediaPages
displayMediaPages()
end if
End Sub


Sub displayMediaPages()
print "Browse.brs [displaymediaPages]"

m.mediaPageList.visible = true
hideMarkupGrid()

m.mediaPageList.setFocus(true)

'Watch for events - Unobserve first to make sure we're not already monitoring
m.mediaPageList.unobserveField("itemFocused")
m.mediaPageList.unobserveField("itemSelected")
m.mediaPageList.observeField("itemFocused", "onMediaPageFocused")
m.mediaPageList.observeField("itemSelected", "onMediaPageSelected")
End Sub


Sub onMediaPageFocused()
'Item focused
focusedItem = m.mediaPageList.content.getChild(m.mediaPageList.itemFocused)
m.mediaPageInfo2.text = focusedItem.shortdescriptionline2
End Sub


Sub onMediaPageSelected()
'Item selected
'print "SELECTED: "; m.mediaPageList.itemSelected

buildMediaList(m.mediaPageList.itemSelected)

End Sub


Sub buildMediaList(index as integer)
m.pageSelected = index
selected = index + 1
totalPages = m.metaData.Count() / m.itemsPerPage
page_end = 0
page_start = m.pageSelected * m.itemsPerPage + 1
currentCount = m.metaData.Count() - page_start
if currentCount > m.itemsPerPage then
page_end=page_start + m.itemsPerPage - 1
else
page_end=page_start + page_end + currentCount
end if

m.imageThumbList = createObject("RoSGNode","ContentNode")
for i = page_start-1 to page_end-1
addItem(m.imageThumbList, "GP_BROWSE", m.metaData[i].url+getResolution("SD"), "", "")
end for

m.itemLabelMain1.text = m.top.albumName+" (page "+selected.ToStr()+" of "+ceiling(totalPages).ToStr()+")"
loadImageList()
End Sub


Sub loadImageList()
print "Browse.brs [loadImageList]"
m.ImageGrid.content = m.top.content
m.itemLabelMain1.text = m.top.albumName
m.ImageGrid.content = m.imageThumbList

if m.top.id = "GP_VIDEO_BROWSE" then
'Copy original list since we can't change origin
m.originalList = m.top.content
end if

showMarkupGrid()
print "Done"

End Sub


Sub onItemFocused()
'Item selected
'print "FOCUSED: "; m.top.metaData[m.ImageGrid.itemFocused]
'print "FOCUSED: "; m.metaData[m.ImageGrid.itemFocused]

if (m.top.metaData[m.ImageGrid.itemFocused].timestamp <> invalid) then
mypath = CreateObject("roPath", m.top.metaData[m.ImageGrid.itemFocused].url)
if (m.metaData[m.ImageGrid.itemFocused].timestamp <> invalid) then
mypath = CreateObject("roPath", m.metaData[m.ImageGrid.itemFocused].url)
fileObj = myPath.Split()

timestamp = friendlyDate(m.top.metaData[m.ImageGrid.itemFocused].timestamp)
m.itemLabelMain2.text = m.top.metaData[m.ImageGrid.itemFocused].filename + " - " + timestamp
timestamp = friendlyDate(m.metaData[m.ImageGrid.itemFocused].timestamp)
m.itemLabelMain2.text = m.metaData[m.ImageGrid.itemFocused].filename + " - " + timestamp
end if
End Sub

Expand All @@ -57,7 +160,7 @@ Sub onItemSelected()

if m.top.id = "GP_IMAGE_BROWSE" then
m.screenActive = createObject("roSGNode", "DisplayPhotos")
m.screenActive.startIndex = m.ImageGrid.itemSelected
m.screenActive.startIndex = m.ImageGrid.itemSelected + (m.pageSelected * m.itemsPerPage)
m.screenActive.predecessor = m.top.predecessor
m.screenActive.albumobject = m.top.albumobject
m.screenActive.content = m.top.metaData
Expand All @@ -72,8 +175,8 @@ Sub onItemSelected()
if m.global.SlideshowOrder <> "" m.showOrder = m.global.SlideshowOrder
if m.global.VideoContinuePlay <> "" m.showVideoPlayback = m.global.VideoContinuePlay

m.videoPlayingindex = m.ImageGrid.itemSelected
doVideoShow(m.top.metaData[m.ImageGrid.itemSelected])
m.videoPlayingindex = m.ImageGrid.itemSelected + (m.pageSelected * m.itemsPerPage)
doVideoShow(m.metaData[m.ImageGrid.itemSelected + (m.pageSelected * m.itemsPerPage)])
end if
End Sub

Expand All @@ -96,9 +199,9 @@ Sub doVideoShow(videoStore as object)
videoContent.streamformat = "mp4"
videoContent.Title = friendlyDate(videoStore.timestamp)
if videoStore.description <> "" then
videoContent.TitleSeason = videoStore.description + " - " + thumbnailObj.filename
videoContent.TitleSeason = videoStore.description + " - " + videoStore.filename
else
videoContent.TitleSeason = thumbnailObj.filename
videoContent.TitleSeason = videoStore.filename
end if

m.VideoPlayer.visible = true
Expand All @@ -121,20 +224,20 @@ Sub onVideoStateChange()
if m.showVideoPlayback = "Continuous Video Playback" then
if m.showOrder = "Random Order" then
'Create image display list - RANDOM
m.videoPlayingindex = GetRandom(m.top.metaData)
m.videoPlayingindex = GetRandom(m.metaData)
else if m.showOrder = "Reverse Album Order"
'Create image display list - REVERSE ALBUM ORDER
m.videoPlayingindex = m.videoPlayingindex-1
if (m.top.metaData[m.videoPlayingindex]=invalid) m.videoPlayingindex = m.top.metaData.Count()-1
if (m.metaData[m.videoPlayingindex]=invalid) m.videoPlayingindex = m.metaData.Count()-1
else
'Create image display list - ALBUM ORDER
m.videoPlayingindex = m.videoPlayingindex+1
if (m.top.metaData[m.videoPlayingindex]=invalid) m.videoPlayingindex = 0
if (m.metaData[m.videoPlayingindex]=invalid) m.videoPlayingindex = 0
end if

if m.top.metaData[m.videoPlayingindex]<>invalid
if m.metaData[m.videoPlayingindex]<>invalid
'Continue playing the next video inline
doVideoShow(m.top.metaData[m.videoPlayingindex])
doVideoShow(m.metaData[m.videoPlayingindex])
end if
else
'Close video screen
Expand Down Expand Up @@ -207,6 +310,7 @@ End Sub


Sub showMarkupGrid()
m.mediaPageList.visible = false
m.ImageGrid.visible = true
m.itemLabelMain1.visible = true
m.itemLabelMain2.visible = true
Expand All @@ -227,6 +331,16 @@ Sub showTempSetting()
End Sub


Sub addItem(store as object, id as string, hdgridposterurl as string, shortdescriptionline1 as string, shortdescriptionline2 as string)
item = store.createChild("ContentNode")
item.id = id
item.title = shortdescriptionline1
item.hdgridposterurl = hdgridposterurl
item.shortdescriptionline1 = shortdescriptionline1
item.shortdescriptionline2 = shortdescriptionline2
End Sub


Function onKeyEvent(key as String, press as Boolean) as Boolean
if press then
if key = "back"
Expand All @@ -242,6 +356,9 @@ Function onKeyEvent(key as String, press as Boolean) as Boolean
m.VideoPlayer.unobserveField("state")
writeVideoPosition(m.VideoPlayer.position)
return true
else if (m.mediaPageList.visible = false) and (ceiling(m.metaData.Count() / m.itemsPerPage) > 1)
displayMediaPages()
return true
end if
else if (key = "options") and (m.screenActive = invalid)
showTempSetting()
Expand Down
Loading

0 comments on commit c47d0c1

Please sign in to comment.