Cast using Youtube app (DIAL/LoungeAPI) (#276)
* Dial+Lounge API PoC * format * Fix for chrome * comments * Rate limit and logger stuff * rename route * remove invalid routes * remove device image * Simplify device description * command test * Lint fix * register pairing code * tv code UI * Lint fix * Avoid creating lots of objects * dpad command * small refactor * tweak * validation * timer * fix * Revert "timer" This reverts commit e349565910882408898c9bddda55dadaa9d743de. * Commands * setVolume command * lounge service timer * Some state messages * Lint fix * player state sync * voice handler * Adjustments, and add a TODO list * Lint fix * comment * play at timestamp * Remote screen UI * UI adjustment * Small refactor * Refactor long polling * Add TODO * Manage logging a bit better to avoid spam in DIAL server * cache dial file * logging * comment * Join lounge lazily * long poller tweak * ui tweak * set shouldQuit field * remote connect notification * Lint fix * Randomize device id, new device on start * Lint fix * Lounge disconnect on start * Speed up lounge by not blocking on sent messages * add version to lounge data saved * dial server fix rendezvous * todo * no message * Display network name * playlist changes * Lint fix * tweak params * tweak * player state * comments * Refactor Video Queue (#295) * Refactor Video Queue * Video queue and playlists * Web app casting * queue playlist notification * VideoQueueView work * restore properties * changes * queue notification and previous/next state * Lint fix * very basic error handling * Update changelog and privacy policy --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
1 parent
ec9178d687
commit
7d1ba07286
85 files changed
+3666
-938
No files matched your search
@@ -0,0 +1,110 @@
|
||||
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||
import "pkg:/components/Services/LoungeService/LoungeConstants.bs"
|
||||
import "pkg:/components/VideoQueue/Notifications/VideoQueueNotificationUtils.bs"
|
||||
|
||||
namespace LoungeVideoQueue
|
||||
function SetPlaylist(videoQueueNode as object, invService as object, playlistData as object)
|
||||
HandleLoungePlaylist(videoQueueNode, invService, playlistData)
|
||||
end function
|
||||
|
||||
function UpdatePlaylist(videoQueueNode as object, invService as object, playlistData as object)
|
||||
HandleLoungePlaylist(videoQueueNode, invService, playlistData)
|
||||
end function
|
||||
|
||||
function HandleLoungePlaylist(videoQueueNode as object, invService as object, playlistData as object) as void
|
||||
videoIds = playlistData[FIELD_VIDEO_IDS]
|
||||
if StringUtils.IsNullOrEmpty(videoIds)
|
||||
videoQueueNode.clearQueue = true
|
||||
return
|
||||
end if
|
||||
|
||||
videoIds = videoIds.Split(",")
|
||||
queueContent = videoQueueNode.content
|
||||
currentQueueNodes = queueContent.getChildren(-1, 0)
|
||||
queueNodesDict = {}
|
||||
for each node in currentQueueNodes
|
||||
queueNodesDict[node.id] = node
|
||||
end for
|
||||
|
||||
instance = invalid
|
||||
newQueueNodes = []
|
||||
for each vId in videoIds
|
||||
if queueNodesDict.DoesExist(vId)
|
||||
newQueueNodes.Push(queueNodesDict[vId])
|
||||
else
|
||||
payload = {
|
||||
"type": "video"
|
||||
"videoId": vId
|
||||
}
|
||||
|
||||
if instance = invalid
|
||||
instance = invService.GetInstance()
|
||||
end if
|
||||
|
||||
contentNode = InvidiousContent.ToVideoContentNode(invalid, payload, instance)
|
||||
newQueueNodes.Push(contentNode)
|
||||
end if
|
||||
end for
|
||||
|
||||
index = -1
|
||||
currentIndex = playlistData[FIELD_CURRENT_INDEX]
|
||||
if IsString(currentIndex)
|
||||
currentIndex = CInt(Val(currentIndex))
|
||||
index = currentIndex
|
||||
else
|
||||
index = videoQueueNode.index
|
||||
end if
|
||||
|
||||
videoQueueNode.setQueueAndIndex = {
|
||||
videoNodes: newQueueNodes
|
||||
index: index
|
||||
}
|
||||
|
||||
videoId = playlistData[FIELD_VIDEO_ID]
|
||||
timestamp = playlistData[FIELD_CURRENT_TIME]
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(videoId)
|
||||
if not StringUtils.IsNullOrEmpty(timestamp)
|
||||
timestamp = CInt(Val(timestamp))
|
||||
if timestamp > 0
|
||||
node = newQueueNodes[index]
|
||||
node.timestamp = timestamp
|
||||
end if
|
||||
end if
|
||||
|
||||
videoQueueNode.play = true
|
||||
end if
|
||||
|
||||
if StringUtils.IsNullOrEmpty(videoId)
|
||||
eventDetails = playlistData[FIELD_EVENT_DETAILS]
|
||||
if IsString(eventDetails)
|
||||
eventDetails = ParseJson(eventDetails)
|
||||
end if
|
||||
if eventDetails <> invalid and eventDetails["eventType"] = "VIDEO_ADDED"
|
||||
eventVideoId = eventDetails[FIELD_VIDEO_ID]
|
||||
if not StringUtils.IsNullOrEmpty(eventVideoId)
|
||||
preferences = videoQueueNode.preferences
|
||||
queueNotifications = preferences["misc.queue_notifications"]
|
||||
if queueNotifications
|
||||
payload = {
|
||||
"type": "video"
|
||||
"videoId": eventVideoId
|
||||
}
|
||||
|
||||
if instance = invalid
|
||||
instance = invService.GetInstance()
|
||||
end if
|
||||
|
||||
node = InvidiousContent.ToVideoContentNode(invalid, payload, instance)
|
||||
|
||||
notifications = videoQueueNode.notifications
|
||||
hintVisible = videoQueueNode.player = invalid or not videoQueueNode.videoContainer.fullscreen
|
||||
VideoQueue.ShowNotifcation(notifications, node, hintVisible)
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end function
|
||||
|
||||
end namespace
|
||||
Reference in new issue
Block a user