I've been using yt-dlp
to download audio files before running mpv
for playing them back.
I've been specifically using the following commands:
yt-dlp -f ba "ytsearch:major artist cool music"
mpv [Title of the audio file downloaded].webm
Now, what bothers me is that I would prefer to have a super command that chains the both of them without having to wait and follow-up with the mpv command after the download concludes.
The bottleneck for downloading the file is understandable, and the randomness of the file name is reasonable since the search criteria depends on YouTube's algorithm to return the best search.
Is there a command that knows beforehand the most recent downloaded file and allows mpv
to play the file as soon as it finishes downloading regardless of its file name?
I have tried the usual piping a la yt-dlp ... | mpv
but it yielded errors. My understanding of UNIX is still wanting but I'll address that however you advise.
To add to my personal debugging of this scripting issue, E.g.:
mpv | yt-dlp -f ba "ytsearch:selena gomez good for you remix lyrics" -
Yields this error:
ERROR: [generic] None: '-' is not a valid URL. Set --default-search "ytsearch" (or run yt-dlp "ytsearch:-" ) to search YouTube
yt-dlp
was downloaded via pip(Python 3.11).
All this running in Windows 11 Terminal (Windows Powershell). But I don't see why it can't apply on (U/Li)nux
yt-dlp
's-g
switch? Or-o
? (hint: have you read theyt-dlp
man page?) – Marcus Müller Jun 29 '23 at 09:45No I'm not familiar with any of those. Was just looking for a "high level" way of overriding those commands since mpv is involved. Haven't checked out the manual in a while. I'll get to it before I get back to you
– Gabe Devs Jun 29 '23 at 09:49-o
and the-g
flags.-g
is particularly useful sincempv
can playback the audio from the link. But I still need a way to search then immediately playback whatever link gets output. More help would be appreciated.Something like:
– Gabe Devs Jun 29 '23 at 10:11mpv | yt-dlp -f ba "ytsearch:selena gomez good for you remix lyrics" -g
mpv $(yt-dlp -f ba "ytsearch:selena gomez good for you remix lyrics" -g)
Thanks for the direction
– Gabe Devs Jun 29 '23 at 10:14