Giter Club home page Giter Club logo

lbry.go's Introduction

The LBRY Protocol in Go

lbry.go is a set of tools and projects implemented in Golang. See each subfolder for more details

there are significant updates in the v3 branch. if you're starting a new project, strongly consider using that version instead

Build Status

This project uses Go modules. Make sure you have Go 1.11+ installed.

Building

  • clone the repository
  • run make from the root directory to build the binary

Contributing

Contributions to this project are welcome, encouraged, and compensated. For more details, see lbry.com/faq/contributing

Make sure you go fmt your code before submitting PRs.

Versioning

This codebase follows the semver standards. You can find the releases here

You can include the libraries by running go get github.com/lbryio/lbry.go@latest. You can lock (and you should) to a version whenever you make use of this set of libraries.

License

This project is MIT licensed. For the full license, see LICENSE.

Security

We take security seriously. Please contact [email protected] regarding any issues you may encounter. Our PGP key is here if you need it.

Contact

The primary contact for this project is @lyoshenka ([email protected])

lbry.go's People

Contributors

aarondl avatar anbsky avatar guregu avatar jackrobison avatar jedborovik avatar jeffreypicard avatar joelkek avatar jseriff avatar justinas avatar lbrydocs avatar lyoshenka avatar nikooo777 avatar nullbio avatar roylee17 avatar shyba avatar strikerrus avatar tiger5226 avatar tzarebczan avatar ykris45 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lbry.go's Issues

Find out if we can download videos in highest quality available

Niko mentioned we are using a setting for the yt downloader that's supposed to get the best qualify video available. A user recently reached out asking what format his videos will be uploaded it and when I did some digging, it looks like we are only grabbing 720p versions.

Example:
https://www.youtube.com/watch?v=NIVms5W0PqQ - has 1080p60 option, but the file we have is in 720p lbry://attack-on-titan-2-review-fight-on#bb202489329ca6f7639e38101c5fc83e265088e7

add support for priced content

Some content publishers want to have their videos published for a price.
For this reason ytsync must fetch the following parameters from the API: fee_amount, fee_currency, fee_address and then supply them when calling the publish method.
This issue depends on the implementation on the API side first.

Concurrency while publishing files with the same name

consider the following videos:

  1. My awesome dog and its friend speedy (part 1)
  2. My awesome dog and its friend speedy (part 2)
  3. My awesome dog and its friend speedy (part 3)
  4. My awesome dog and its friend speedy (part 4)
  5. My awesome dog and its friend speedy (part 5)

the claim name is based on the title, a limit is enforced thus trimming out a part of the name.

claim name for the 5 videos as computed by the algorithm:

  1. my-awesome-dog-and-its-friend-sp
  2. my-awesome-dog-and-its-friend-sp
  3. my-awesome-dog-and-its-friend-sp
  4. my-awesome-dog-and-its-friend-sp
  5. my-awesome-dog-and-its-friend-sp

lbry.go attempts to publish all videos concurrently. The end result is ambiguous. If they are of similar size they will end up being published in the same block. some will be rejected, some will not. If a video goes through on block 100, the other 4 risk either failing and attempting the very subsequent my-awesome-dog-and-its-friend-sp-1... or updating the previous claim. If they go through in the same block, separate claims with the same claim_name are sent through (I believe).

All in all it's a chaos.
A solution should ensure that no 2 videos can attempt publishing using the same name ever.

My idea: the video tracking table contains the claim names used, said claim names should be returned (and probably are already returned) together with the channel status response payload.
lbry.go needs to check against that list before attempting a publication, if a collision is detected, another name should be attempted.

ytsync refactor #1

The codebase needs to be heavily refactored.
This issue wants to track the first stage of refactoring which aims at:

  • Using factory pattern to reduce errors/mistakes while instantiating the manager or the sync structs
  • bundling data in structures to avoid passing down long lists of variables
  • better organizing the code so that it's slightly more readable

Consider how to set copyright / ask publisher

Some publishers do not wish to retain copyright or wish to publish under creative commons or similar.

If this information is available via YouTube, we should match it.

If not, we should ask but provide a sane default (e.g. it could be on the lbry.io/youtube/token status page).

Steps:

  • When publishing, fetch status.license from youtube api (https://developers.google.com/youtube/v3/docs/videos#status.license). If license is creativeCommon, publish under the creative commons license (check which one youtube uses and use the same). If its youtube, do whatever we do now.
  • add a note on the youtube/token page explaining how we'll be setting the license on published content, and tell the user to email us if they want a different treatment for their content. use our support email

Acceptance Criteria

Definition of Done

  • Tested against acceptance criteria
  • Tested against the assumptions of the user story
  • The project builds without errors
  • Unit tests are written and passing
  • Tests on devices/browsers listed in the issue have passed
  • QA performed & issues resolved
  • Refactoring completed
  • Any configuration or build changes documented
  • Documentation updated
  • Peer Code Review performed

endless loop in ytsync when a queue is empty

Possibly related to #19

When the sync tool pulls an empty queue or finishes its jobs it cycles endlessly spamming slack and the API.

A timeout and a check on the jobs should be added to prevent this.

Adjust ytsync queues

A channel might be in one of the following states:

  • pending (awaiting approval by the owner)
  • queued (approved, awaiting synchronization)
  • syncing (being synchronized by the tool)
  • synced (finished synchronizing)
  • failed (failure in synchronizing)

The ytsync tool is capable of fetching from all those queues depending on the startup instructions.

When syncing without specific flags the behavior should be the following:

  1. process the syncing queue (if anything was left half-way previously it will be finished first)
  2. sync the queued queue
  3. repeat endlessly or until the maximum number of cycles (specified) is reached

When syncing with the update flag:

  1. process the syncing queue (if anything was left half-way previously it will be finished first)
  2. sync the synced queue (all previously synced channels will be updated)
  3. repeat endlessly or until the maximum number of cycles (specified) is reached

when syncing with a status specified:

  1. sync that specified queue only

Something in the logic isn't quite right and the wrong queues are pulled.

video is bigger than 2GB, skipping for now

We should determine if we'll ever be syncing larger videos than 2 GB and if so, when would be a good time to process them (probably after adding publish date metadata).

shutdown behavior is dangerous

When the sync tool instructs the daemon to shut down, the daemon returns correctly, however it returns too soon and the tool has no clue when the daemon effectively will stop.
For this reason the wallet is being moved before the daemon shuts down and strange things can happen.

Some files converted to non-compatible format

In certain cases, not sure if this is related to resolution or video quality, the yt downloader uses a VP80 Codec (https://www.screencast.com/t/YpjByam5) and not the typical web optimized h264. I remember we ran into something similar a while ago with John Cleese videos.

Here's an example: lbry://the-metagame-batman-arkham-asylum-20

Not sure what we can do in this case, but maybe we can force h264 or convert via ffpmeg.

Add more parameters to limit ytsync

We want to be able to decide sync limits dynamically without having the recompile the binary each time.

For that the following parameters should be added:

  • [] Amount of videos to sync per channel at most
  • [] Maximum size of a single video to sync (in MB?)

Rename this repo

lbry.go is a confusing name for what this does.

Also, should this be public?

Wrapped errors appear as robot vomit in test failure messages

When assertions like assert.Nil(t, err) for extras.errors.Err fail in tests, this is the output I'm getting:

            Error Trace:    lbrynet_test.go:75
            Error:          Expected nil, but got: &errors.Error{Err:(*errors.errorString)(0xc0000b06a0), stack:[]uintptr{0x1511f5b, 0x151293a, 0x10fd080, 0x105da11}, frames:[]errors.StackFrame(nil), prefix:""}

In contrast, this is the output for the standard errors.New object in the same spot:

            Error Trace:    lbrynet_test.go:75
            Error:          Expected nil, but got: &errors.errorString{s:"empty structure from sdk client"}

Examples for using this repo to download LBRY content?

I would like to write a client program that, given a LBRY URI (e.g. lbry://@irmf#a/irmf-logo-model-1.irmf#4),
the client downloads the data (provided that either the user has already paid for the content or the content is free).

Eventually, it would be nice to allow the user to optionally send credits if the content is gated and they have not already purchased it. But for starting out, I would just like to download the content that is either free or previously-paid-for.

I'm not finding any examples, and searching through the subdirectories, it is not obvious to me how to get started.

If I were to take a random stab-in-the-dark, for example, I might try doing the following:

  • lbrycrd.New(lbrycrdURL, chainParams) (What should lbrycrdURL and chainParams be?)

but then I get stuck, as none of the methods appear to be what I want.

Alternatively, maybe I need to go this route:

  • blobex.NewBlobExchangeClient(cc) (How should I get cc correctly?)
  • blobex.Download(ctx) (How do I specify the URI for the content?)

Can you please provide some guidance on the steps that need to be taken?

Thank you!

UXP browsers don't work. (White screen)

Here's the deal: there's a project called "Unified XUL Browser" (also known as "UXP"), which is basically a platform for developing applications using web code. UXP was originally a fork of the Firefox codebase, although there's been significant divergence over the years.

The community that maintains UXP also maintains two browsers that take advantage of it: Basilisk, and Pale Moon. IMHO, they are both a lot lighter than upstream Firefox, which is why I love them. They both use a Gecko-like fork called Goanna.

Unfortunately, if I try to use either browser on beta.lbry.tv, they both give me a blank, white screen. I've checked the url, and it was correct. I've also tried using both browsers with brand new profiles (just in case the problem had something to do with one of my addons), but that didn't help.

Please fix this issue, as the laptop I'm typing this on doesn't *quite*

have enough RAM to use upstream Firefox - much less Chrome, which is an even bigger RAM hog.

Here's a screenshot of what my problem is:

blank-page

I'm running Ubuntu GNU/Linux x64, if that helps.

Delay syncing video if newly posted / not post processed

I think we may sometimes run into a scenario where we sync a video before it is post-processed in 720P+ on YouTube so we end up syncing a lower quality version. We should check when the video was posted, and if it's very recent (not sure what the timing for post-processing looks like), delay download/publish until the next iteration.

Channels should be able to be synced and updated on different servers

Currently ytsync assumes that a channel is first synced and subsequently updated on the same server. This doesn't allow us to balance the load and make full use of fleets (group of temporary servers).

The following steps should be taken:

  • Remove redis dependency
  • replace current functionalities that use redis with new ones using the new synced_videos table in internal-apis
  • remove dependency of the local wallet directory and solely use the S3 storage
  • enable versioning of the wallets
  • think of an "external" lbrycrd server that feeds the ytsync servers so to avoid having to run a lbrycrd instance for all ytsync servers

Handle short reads in stream encoder

In Encoder.Next(), every read creates a blob even if you only read one byte. Instead it should keep reading until it has a full blob's worth of data or hits EOF.

deprecate sync_server dependency

Currently, lbry.go checks the sync_server field in order to understand if a given channel can be synced or not (only one server can sync a channel).

By solving this issue both in lbry.go and internal-apis we will be able to update a channel that was previously synced on a different server.

For this to work we need to ensure that two servers can't ever be syncing the same channel at the same time.

The download directory gets deleted before the publish finishes

*/10 * * * * (/bin/ls /tmp/ | /bin/grep -q ytsync && /usr/bin/find /tmp/ytsync* -mmin +20 -delete) || true
^ the above command might have something to do with this error.

At a certain point the download might fail and from there on all publishes fail.

example: ERRO[62269] error processing video: download error: open /tmp/ytsync259862098/iMvNYejP8xY.mp4: no such file or directory

this is probably also related to what i experienced a couple of days ago

INFO[4719] Processing 9rscUMFPQ8c (14237 in channel)
DEBU[4721] Downloaded 9rscUMFPQ8c
DEBU[4722] Created thumbnail for 9rscUMFPQ8c
DEBU[4722] jsonrpc: publish author=David Pakman Show bid=0.01 channel_name=@davidpakman claim_address=bZxmbHGKxuo5ewDP8Cedkyt5ippCxHHC3i description=--Mitt Romney's mobile app misspells America as "Amercia" and we wonder if that's actually the country that will benefit if Romney becomes President.

--On the Bonus Show: Misleading Drudge headline, TX honor student jailed for missing class, Bilderberg US meeting upcoming, more.

The David Pakman Show is an internationally syndicated talk radio and television program hosted by David Pakman

http://www.davidpakman.com
http://www.davidpakman.com/membership
http://www.davidpakman.com/gear
http://www.facebook.com/davidpakmanshow
...
https://www.youtube.com/watch?v=9rscUMFPQ8c file_path=/tmp/ytsync782624140/9rscUMFPQ8c.mp4 language=en license=Copyrighted (contact author) name=romney-campaign-misspells-america-on thumbnail=https://berk.ninja/thumbnails/9rscUMFPQ8c title=Romney Campaign Misspells AMERICA on Mobile App
INFO[5029] 9rscUMFPQ8c took 5m8.70042584s
ERRO[5030] error processing video: publish error: Post http://localhost:5279: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
INFO[5033] Retrying
INFO[5034] Processing 9rscUMFPQ8c (14237 in channel)
DEBU[5039] 9rscUMFPQ8c already exists at /tmp/ytsync782624140/9rscUMFPQ8c.mp4
DEBU[5040] Downloaded 9rscUMFPQ8c
INFO[5080] 9rscUMFPQ8c took 41.630574618s
ERRO[5085] error processing video: thumbnail error: Put https://jgp4g1qoud.execute-api.us-east-1.amazonaws.com/prod/thumbnail: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
INFO[5089] Retrying
INFO[5090] Processing 9rscUMFPQ8c (14237 in channel)
DEBU[5092] 9rscUMFPQ8c already exists at /tmp/ytsync782624140/9rscUMFPQ8c.mp4
DEBU[5094] Downloaded 9rscUMFPQ8c
INFO[5128] 9rscUMFPQ8c took 37.483586185s
ERRO[5129] error processing video: thumbnail error: Put https://jgp4g1qoud.execute-api.us-east-1.amazonaws.com/prod/thumbnail: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
INFO[5129] Video failed after 3 retries, skipping

so either the download error is not handled correctly or the cronjob deletes videos when it's not supposed to do so.

for ytsync, detect when lbrycrd is not running and error appropriately

Acceptance Criteria

Definition of Done

  • Tested against acceptance criteria
  • Tested against the assumptions of the user story
  • The project builds without errors
  • Unit tests are written and passing
  • Tests on devices/browsers listed in the issue have passed
  • QA performed & issues resolved
  • Refactoring completed
  • Any configuration or build changes documented
  • Documentation updated
  • Peer Code Review performed

rename youtube video files

Rather than publishing the file as the unique id inserted into YouTube, can we instead have a smarter algorithm that trims/compresses the video title?

Something like following replaces coupled with a 25-30 char limit would probably get most of the way:

/[^\p{L}]//
/\s+/-

A smarter version could split on spaces/dashes and try to ensure it only uses a whole number of words.

ytsync should wait for a full startup before starting to publish

ERRO[0874] error processing video: publish error: Error in daemon: the following required components have not yet started: ["wallet", "file_manager", "blob_manager", "payment_rate_manager", "database"] 
ERRO[0874] Video failed after 3 retries, skipping. Stack: error processing video: publish error: Error in daemon: the following required components have not yet started: ["wallet", "file_manager", "blob_manager", "payment_rate_manager", 
"database"] 

Align lbrycrd SDK to latest version

Version 17 of lbrycrd deprecated several functions and added others.

We need to find and deprecate all the old ones and replace/add the new ones

Adjust the UCB code

In order to be able to finish publishing all UC Berkeley videos to LBRY the following steps need to be taken:

  • Adjust cmd/ytsync.go to allow selecting the UCB publisher
  • verify that every step of the "download", metadata acquisition, publication, database tracking work
  • ensure that redisdb is no longer necessary anywhere in udb (should not)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.