Download video to sync to local cache #113
No reviewers
Labels
No labels
area: devops
area: discovery
area: docs
area: livestream
area: proposal
consider soon
dependencies
Epic
good first issue
hacktoberfest
help wanted
icebox
level: 1
level: 2
level: 3
level: 4
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
on hold
priority: blocker
priority: high
priority: low
priority: medium
resilience
sdk dependent
Tom's Wishlist
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/ytsync#113
Loading…
Reference in a new issue
No description provided.
Delete branch "pseudoscalar/issue/112/v1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Partial completion of v1 of issue #112. Drafting this PR for discussion.
i recommend os.ReadFile() to read the file in one go
Posting some work before I get too far off into the weeds. There are some comments about improvements that could be made to the go jsonrpc client, and stuff I still need to do for the upload. This is due for a refactor, I just wanted to get the whole process out into code before figuring out how to organize it.
id call this something other than
done
to make it clear its a channel that lets you know when the video is done reflectingminor nit, but doesn't this potentially make the description longer than the max length?
@ -22,0 +86,4 @@
videoID := args[0]
log.Debugf("Running sync for video ID %s", videoID)
prolly need to make sure this exists
if this is an error (or an unexpected thing), it should prolly send an error to
done
, right?@ -0,0 +18,4 @@
func NewYouTubeAPIVideoEnricher(apiKey string) (*YouTubeAPIVideoEnricher) {
enricher := YouTubeAPIVideoEnricher{
api: NewYouTubeAPI(apiKey),
so the best way to get the release time was via the api? if so, can you include instructions in your PR on what a user would need to do to get an api key? we'd also want to add handling in a later version for exceeding api limits
@ -0,0 +59,4 @@
FullLocalPath: videoPath,
}
for _, enricher := range s.enrichers {
this is an interesting design. what other enrichers did you envision?
@ -22,0 +86,4 @@
videoID := args[0]
log.Debugf("Running sync for video ID %s", videoID)
This should be guaranteed by
cobra.ExactArgs(1)
, but I can a check and error here too.This was mostly ripped from
getAbbrevDescription
in sources/youtubeVideo.go. I didn't know exactly where the value of 2800 came from, so I just assumed the logic was correct. If it is supposed to be a limit on the total description length, I'll fix this.@ -0,0 +18,4 @@
func NewYouTubeAPIVideoEnricher(apiKey string) (*YouTubeAPIVideoEnricher) {
enricher := YouTubeAPIVideoEnricher{
api: NewYouTubeAPI(apiKey),
This was the simplest and most direct way, and the API limits seem like more than enough for the single channel use-case (except on initial channel sync). Should I add the instructions to the local/readme.md?
@ -0,0 +59,4 @@
FullLocalPath: videoPath,
}
for _, enricher := range s.enrichers {
This mainly came out of trying to accommodate easy switching between methods of getting release date and also allowing for fallback to multiple methods. The other methods in mind were things like the odysee API, multiple YouTube API keys, a future update to yt-dlp that might provide it, web scraping (although I don't think this would currently work as only the date is provided), or some 3rd party metadata provider. In the single video use-case, there could even be an enricher that just supplies values specified on the command line.
The design here is meant to put together a list of enrichers based on command line options. The enrichers will then take turns trying fill-in the missing video metadata (although right now, it is only trying to fill-in release date)
The thinking was that this may be intentional since it is driven by lbrynet settings. I could turn this into an error if that case is unlikely. I could also add a command line flag to indicate that streams won't be reflected.
@ -22,0 +86,4 @@
videoID := args[0]
log.Debugf("Running sync for video ID %s", videoID)
you're right, i just didnt notice that
yea id either make it an option or just assume that all streams will be reflected. option is better but more work
i think that's an estimate of how long the description can get before we hit the max claim size limit. id still fix it so the math is right though :-)
@ -0,0 +18,4 @@
func NewYouTubeAPIVideoEnricher(apiKey string) (*YouTubeAPIVideoEnricher) {
enricher := YouTubeAPIVideoEnricher{
api: NewYouTubeAPI(apiKey),
yea
@ -0,0 +18,4 @@
func NewYouTubeAPIVideoEnricher(apiKey string) (*YouTubeAPIVideoEnricher) {
enricher := YouTubeAPIVideoEnricher{
api: NewYouTubeAPI(apiKey),
maybe add a note to the issue to give the user a good error message if the api runs out of credits, and stop the sync. getting the release time right is fairly important so we don't want to guess or leave it empty. this could go under v4
@ -0,0 +59,4 @@
FullLocalPath: videoPath,
}
for _, enricher := range s.enrichers {
👍
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.