-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
Add cover manager #3651
Add cover manager #3651
Conversation
@Moonbase59 do you know who authored this initially? |
03a348e
to
eb4acf7
Compare
@toots No, I don’t know for sure, but I think it was @vitoyucepi – see #3402 (reply in thread), #3402 (comment) and #3402 (reply in thread). |
Co-authored-by: Vito <[email protected]>
src/libs/extra/metadata.liq
Outdated
def set_current_cover(filename) = | ||
current_cover = current_cover_file() | ||
if | ||
current_cover != default | ||
then | ||
log.info( | ||
label=id, | ||
"Removing #{string.quote(current_cover)}" | ||
) | ||
file.remove(current_cover) | ||
end | ||
current_cover_file := filename | ||
end |
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.
I wonder if current_cover_file
might point to a non-existent file after removing the previous one.
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.
Yeah we can inverse the order of operations to avoid a race condition.
@@ -173,14 +173,21 @@ let _ = | |||
"Return a fresh temporary filename. The temporary file is created empty, \ | |||
with permissions 0o600 (readable and writable only by the file owner)." | |||
[ | |||
( "dir", |
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.
I don't like abbreviations in argument names
( "dir", | |
( "directory", |
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.
Sorry just seeing this. Will apply to main
.
("", Lang.string_t, None, Some "File prefix"); | ||
("", Lang.string_t, None, Some "File suffix"); | ||
] | ||
Lang.string_t | ||
(fun p -> | ||
let temp_dir = | ||
Lang.to_valued_option Lang.to_string (List.assoc "dir" p) |
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.
Lang.to_valued_option Lang.to_string (List.assoc "dir" p) | |
Lang.to_valued_option Lang.to_string (List.assoc "directory" p) |
# Store and retrieve file covers using metadata. This returns a set of | ||
# getter/setter methods that can be used to store and retrieve cover art. | ||
# Typical usage is to set cover art in a `on_metadata` handler and retrieve | ||
# it in a `video.add_image` operator. |
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.
Since this can be a bit complicated for some users, it would be nice to add another source.video_from_cover
operator based on this which takes an audio track and adds a video track based on the cover!
Co-authored-by: Samuel Mimram <[email protected]> Co-authored-by: Vito <[email protected]>
Add an extra API that facilitates the handling of covers to be used in video streams. Original code by @vitoyucepi