-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetch playback URL for imported asset using source URL #1370
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will let Victor review since he's more familiar. Excited to get this deployed.
limit: 2, | ||
order: "coalesce((asset.data->'createdAt')::bigint, 0) ASC", | ||
}); | ||
if (!assets || assets.length < 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as discussed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a quick glance looks good! I can look in detail in a minute but feel free to merge as is.
@@ -47,7 +47,8 @@ const getAssetPlaybackUrl = async ( | |||
cid: boolean | |||
) => { | |||
const asset = cid | |||
? await db.asset.getByIpfsCid(id) | |||
? (await db.asset.getByIpfsCid(id)) ?? | |||
(await db.asset.getBySourceURL("ipfs://" + id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might wanna add the ar://
here if we add support for that on task runner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in #1372
7a69c07
to
9951068
Compare
Missing asset_source_url index in expected result
Codecov Report
@@ Coverage Diff @@
## master #1370 +/- ##
===================================================
+ Coverage 52.12026% 52.21675% +0.09649%
===================================================
Files 68 68
Lines 4457 4466 +9
Branches 831 834 +3
===================================================
+ Hits 2323 2332 +9
Misses 1838 1838
Partials 296 296
Continue to review full report at Codecov.
|
What does this pull request do? Explain your changes. (required)
Supersedes #1367. This PR is also built off of #1365 which introduces a
source
field to theAsset
entity.This new (and simpler impl in Studio!) approach depends on livepeer/task-runner#76. Instead of allowing a user to specify arbitrary source IDs that can be used to lookup a playback URL via the /playback endpoint, Studio relies on task-runner to handle ipfs:// URLs by importing the asset using a list of trusted IPFS gateways to ensure that the asset imported matches the CID in the ipfs:// URL.
The /playback endpoint will try the following in order for a CID:
storage.ipfs.cid
field of an asset which will be populated if the asset was exported to IPFS by Studiosource.url
field of an asset which will be populated if the asset was imported from IPFS by Studio. A playback URL will only be returned if the asset'sstatus
is set toready
which indicates that the asset was actually successfully imported.Specific updates (required)
See commit history.
Updated unit tests.
Does this pull request close any open issues?
Fixes #1362
Screenshots (optional):
Checklist: