change youtube-dl to yt-dlp
This commit is contained in:
parent
6ba7201ca1
commit
568d8a1cc2
2 changed files with 15 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
||||||
# musidl
|
# musidl
|
||||||
musidl is a simple command-line utility written in Bash for downloading music from YouTube with id3 tags (used by media players to display the artist, album, etc.). It is licensed under the GNU GPLv3.
|
musidl is a simple command-line utility written in Bash for downloading music from YouTube with id3 tags (used by media players to display the artist, album, etc.). It is licensed under the GNU GPLv3.
|
||||||
|
|
||||||
musidl requires [youtube-dl](https://github.com/ytdl-org/youtube-dl) to get information about and download the audio from videos, [jq](https://github.com/stedolan/jq) to process JSON, and [id3v2](http://id3v2.sourceforge.net/) to add id3 tags.
|
musidl requires [yt-dlp](https://github.com/yt-dlp/yt-dlp) to get information about and download the audio from videos, [jq](https://github.com/stedolan/jq) to process JSON, and [id3v2](http://id3v2.sourceforge.net/) to add id3 tags.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ sudo ln -s $PWD/musidl /usr/local/bin/musidl
|
||||||
|
|
||||||
Help information is also available by running `musidl --help`
|
Help information is also available by running `musidl --help`
|
||||||
|
|
||||||
Usage: `musidl [options]... [url]... (-- [youtube-dl options])`
|
Usage: `musidl [options]... [url]... (-- [yt-dlp options])`
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ Options:
|
||||||
| `-y`, `--year ` | `year` | Set the year (default: detect from YouTube) |
|
| `-y`, `--year ` | `year` | Set the year (default: detect from YouTube) |
|
||||||
| `-T`, `--track` | `track` | Set the track (default: detect from playlist, otherwise none) |
|
| `-T`, `--track` | `track` | Set the track (default: detect from playlist, otherwise none) |
|
||||||
| `-s`, `--show ` | | Print information to stdout instead of downloading to file |
|
| `-s`, `--show ` | | Print information to stdout instead of downloading to file |
|
||||||
| `-o`, `--output ` | | Set the template used for filenames. See the `youtube-dl` documentation for more info |
|
| `-o`, `--output ` | | Set the template used for filenames. See the `yt-dlp` documentation for more info |
|
||||||
| `--color` | `when` | Enable or disable colored output. `<when>` must be `always`, `auto` (default), or `never` |
|
| `--color` | `when` | Enable or disable colored output. `<when>` must be `always`, `auto` (default), or `never` |
|
||||||
|
|
||||||
Any arguments after '--' will be sent to youtube-dl directly. These are not officially supported and some may cause problems.
|
Any arguments after '--' will be sent to yt-dlp directly. These are not officially supported and some may cause problems.
|
||||||
|
|
22
musidl
22
musidl
|
@ -18,14 +18,14 @@
|
||||||
|
|
||||||
|
|
||||||
# check to make sure all commands are available before running
|
# check to make sure all commands are available before running
|
||||||
if ! (command -v "youtube-dl" && command -v "jq" && command -v "id3v2") &>/dev/null; then
|
if ! (command -v "yt-dlp" && command -v "jq" && command -v "id3v2") &>/dev/null; then
|
||||||
>&2 echo "Missing dependencies."
|
>&2 echo "Missing dependencies."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# this is printed on -h/--help
|
# this is printed on -h/--help
|
||||||
helpmsg="Usage: musidl [options]... [url]... (-- [youtube-dl options])
|
helpmsg="Usage: musidl [options]... [url]... (-- [yt-dlp options])
|
||||||
Download music from YouTube using youtube-dl and add id3v2 metadata automatically
|
Download music from YouTube using yt-dlp and add id3v2 metadata automatically
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h --help Print this message and exit
|
-h --help Print this message and exit
|
||||||
|
@ -39,10 +39,10 @@ Options:
|
||||||
-y --year <year> Set the year (default: detect from YouTube)
|
-y --year <year> Set the year (default: detect from YouTube)
|
||||||
-T --track <track> Set the track (default: detect from playlist, otherwise none)
|
-T --track <track> Set the track (default: detect from playlist, otherwise none)
|
||||||
-s --show Print information to stdout instead of downloading to file
|
-s --show Print information to stdout instead of downloading to file
|
||||||
-o --output Set the template used for filenames. See the youtube-dl documentation for more info
|
-o --output Set the template used for filenames. See the yt-dlp documentation for more info
|
||||||
--color <when> Enable or disable colored output. <when> must be always, auto (default), or never
|
--color <when> Enable or disable colored output. <when> must be always, auto (default), or never
|
||||||
|
|
||||||
Any arguments after '--' will be sent to youtube-dl directly. These are not officially
|
Any arguments after '--' will be sent to yt-dlp directly. These are not officially
|
||||||
supported and some may cause problems."
|
supported and some may cause problems."
|
||||||
|
|
||||||
versionmsg="0.0.1"
|
versionmsg="0.0.1"
|
||||||
|
@ -107,12 +107,12 @@ esac
|
||||||
|
|
||||||
if [ -n "$color_enabled" ]; then
|
if [ -n "$color_enabled" ]; then
|
||||||
pref_musidl=$"\x1b[32m[musidl]\x1b[0m"
|
pref_musidl=$"\x1b[32m[musidl]\x1b[0m"
|
||||||
pref_ytdl=$"\x1b[36m[youtube-dl]\x1b[0m"
|
pref_ytdl=$"\x1b[36m[yt-dlp]\x1b[0m"
|
||||||
pref_jq=$"\x1b[35m[jq]\x1b[0m"
|
pref_jq=$"\x1b[35m[jq]\x1b[0m"
|
||||||
errorstr=$"\x1b[31;1mERROR:\x1b[0m"
|
errorstr=$"\x1b[31;1mERROR:\x1b[0m"
|
||||||
else
|
else
|
||||||
pref_musidl="[musidl]"
|
pref_musidl="[musidl]"
|
||||||
pref_ytdl="[youtube-dl]"
|
pref_ytdl="[yt-dlp]"
|
||||||
pref_jq="[jq]"
|
pref_jq="[jq]"
|
||||||
errorstr="ERROR:"
|
errorstr="ERROR:"
|
||||||
fi
|
fi
|
||||||
|
@ -126,8 +126,8 @@ IFS=$'\n'
|
||||||
|
|
||||||
# Download metadata from all the URLs
|
# Download metadata from all the URLs
|
||||||
[ -z "$quiet" ] && echo -e "$pref_musidl downloading data..."
|
[ -z "$quiet" ] && echo -e "$pref_musidl downloading data..."
|
||||||
data=($(youtube-dl -j "${ytdl_args[@]}" "${urls[@]}" 2> >(printStderr "$pref_ytdl")))
|
data=($(yt-dlp -j "${ytdl_args[@]}" "${urls[@]}" 2> >(printStderr "$pref_ytdl")))
|
||||||
[ -z "$data" ] && >&2 echo -e "$pref_musidl $errorstr youtube-dl returned nothing, exiting" && exit 1
|
[ -z "$data" ] && >&2 echo -e "$pref_musidl $errorstr yt-dlp returned nothing, exiting" && exit 1
|
||||||
|
|
||||||
[ -z "$quiet" ] && echo -e "$pref_musidl downloading videos..."
|
[ -z "$quiet" ] && echo -e "$pref_musidl downloading videos..."
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ data=($(youtube-dl -j "${ytdl_args[@]}" "${urls[@]}" 2> >(printStderr "$pref_ytd
|
||||||
# Add a prefix to the messages,
|
# Add a prefix to the messages,
|
||||||
# And only print messages if quiet is off
|
# And only print messages if quiet is off
|
||||||
if [ -z "$show" ]; then
|
if [ -z "$show" ]; then
|
||||||
stdbuf -o0 youtube-dl --no-progress --extract-audio -f bestaudio \
|
stdbuf -o0 yt-dlp --no-progress --extract-audio -f bestaudio \
|
||||||
--audio-format="$arg_format" "${ytdl_args[@]}" ${output_format[@]} "${urls[@]}" \
|
--audio-format="$arg_format" "${ytdl_args[@]}" ${output_format[@]} "${urls[@]}" \
|
||||||
2> >(printStderr "$pref_ytdl") \
|
2> >(printStderr "$pref_ytdl") \
|
||||||
| stdbuf -o0 sed -e 's/^/'"$pref_ytdl"' /' \
|
| stdbuf -o0 sed -e 's/^/'"$pref_ytdl"' /' \
|
||||||
|
@ -144,7 +144,7 @@ if [ -z "$show" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the filenames
|
# Get the filenames
|
||||||
filenames=($(youtube-dl --get-filename --extract-audio -f bestaudio --audio-format="$arg_format" "${ytdl_args[@]}" ${output_format[@]} "${urls[@]}"))
|
filenames=($(yt-dlp --get-filename --extract-audio -f bestaudio --audio-format="$arg_format" "${ytdl_args[@]}" ${output_format[@]} "${urls[@]}"))
|
||||||
|
|
||||||
# Run for each video to tag
|
# Run for each video to tag
|
||||||
for i in "${!data[@]}"; do
|
for i in "${!data[@]}"; do
|
||||||
|
|
Loading…
Reference in a new issue