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:
Brahim Hadricheandgithub-action linter authored and GitHub committed 2024-02-19 16:30:48 -05:00
1 parent ec9178d687
commit 7d1ba07286
85 files changed
+3666 -938

No files matched your search

@@ -41,26 +41,16 @@ namespace Invidious
function new(node as object)
m.node = node
m.endpoints = node.apiDefinitions
m.responseHandlers = {
DefaultHandler: m.DefaultHandler
AuthFeedHandler: m.AuthFeedHandler
PlaylistHandler: m.PlaylistHandler
VideoInfoHandler: m.VideoInfoHandler
PlaylistInfoHandler: m.PlaylistInfoHandler
ChannelInfoHandler: m.ChannelInfoHandler
ChannelVideosHandler: m.ChannelVideosHandler
ChannelPlaylistsHandler: m.ChannelPlaylistsHandler
WatchHistoryHandler: m.WatchHistoryHandler
}
end function
function DefaultQueryParams() as object
return {
region: m.node.applicationInfo@.GetUserCountryCode()
}
if m._defaultQueryParams = invalid
m._defaultQueryParams = {
"region": m.node.applicationInfo@.GetUserCountryCode()
}
end if
return m._defaultQueryParams
end function
function GetAuthenticationHeaders(token as string) as object
@@ -187,6 +177,10 @@ namespace Invidious
feedSource = feedSources[feedSourcesIndex]
if m.endpoints = invalid
m.endpoints = m.node.apiDefinitions
end if
endpoint = m.endpoints[feedSource.endpoint]
if endpoint = invalid or StringUtils.IsNullOrEmpty(endpoint.paginationType)
return feedSource
@@ -220,6 +214,10 @@ namespace Invidious
end function
function MakeRequest(feedSource as object, additionalQueryParams = invalid as object, cancellation = invalid as object) as object
if m.endpoints = invalid
m.endpoints = m.node.apiDefinitions
end if
endpoint = m.endpoints[feedSource.endpoint]
if endpoint = invalid
return {
@@ -291,6 +289,20 @@ namespace Invidious
response = request.Await()
if m.responseHandlers = invalid
m.responseHandlers = {
DefaultHandler: m.DefaultHandler
AuthFeedHandler: m.AuthFeedHandler
PlaylistHandler: m.PlaylistHandler
VideoInfoHandler: m.VideoInfoHandler
PlaylistInfoHandler: m.PlaylistInfoHandler
ChannelInfoHandler: m.ChannelInfoHandler
ChannelVideosHandler: m.ChannelVideosHandler
ChannelPlaylistsHandler: m.ChannelPlaylistsHandler
WatchHistoryHandler: m.WatchHistoryHandler
}
end if
responseHandler = endpoint.responseHandler <> invalid ? m.responseHandlers[endpoint.responseHandler] : m.responseHandlers["DefaultHandler"]
result = responseHandler(m, feedSource, response)
@@ -1,4 +1,5 @@
import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/TimeUtils.bs"
namespace InvidiousContent
@@ -33,7 +34,8 @@ namespace InvidiousContent
end if
node.type = "video"
SetIfExists(node, "author", item, "author")
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
SetIfExists(node, "_author", item, "author")
SetIfExists(node, "authorId", item, "authorId")
SetIfExists(node, "lengthSeconds", item, "lengthSeconds")
node.lengthText = TimeUtils.GetFormattedTime(item.lengthSeconds)
@@ -43,6 +45,7 @@ namespace InvidiousContent
VideoSetThumbnail(node, item, instance)
SetIfExists(node, "title", item, "title")
SetIfExists(node, "timestamp", item, "timestamp")
SetIfExists(node, "id", item, "videoId")
SetIfExists(node, "videoId", item, "videoId")
node.viewCountText = VideoGetViewCountText(item)
SetIfExists(node, "index", item, "index")
@@ -61,6 +64,7 @@ namespace InvidiousContent
SetIfExists(node, "_author", item, "author")
SetIfExists(node, "authorId", item, "authorId")
SetIfExists(node, "description", item, "description")
SetIfExists(node, "id", item, "playlistId")
SetIfExists(node, "playlistId", item, "playlistId")
SetIfExists(node, "title", item, "title")
SetIfExists(node, "videoCount", item, "videoCount")
@@ -105,6 +109,7 @@ namespace InvidiousContent
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
SetIfExists(node, "_author", item, "author")
SetIfExists(node, "id", item, "authorId")
SetIfExists(node, "authorId", item, "authorId")
SetIfExists(node, "channelHandle", item, "channelHandle")
SetIfExists(node, "description", item, "description")