dotfiles/.ksh/ytdl.ksh

58 lines
1.3 KiB
Bash
Raw Normal View History

########################################################################
# YOUTUBE-DL
########################################################################
ytdl_playlist() {
yt-dlp \
-o '%(playlist_title)s/%(title)s.%(ext)s' \
"$@";
}
ytdl_channel() {
yt-dlp \
--download-archive ytdl_channel.txt \
-o '%(upload_date)s - %(title)s.%(ext)s' \
"$@";
}
ytdl_bandcamp() {
yt-dlp \
--extract-audio \
--audio-format mp3 \
--embed-thumbnail \
--add-metadata \
-o '%(artist)s/%(album)s/%(track_number)02d - %(track)s.%(ext)s' \
"$@";
}
ytdl_audio() {
yt-dlp \
-f bestaudio \
--extract-audio \
--embed-thumbnail \
--add-metadata \
-o "%(title)s-%(id)s.%(ext)s" \
"$@";
}
xdl() {
if [ ! -z $2 ]
then
mkdir -p "$HOME/x/$1/"
cd "$HOME/x/$1/" && yt-dlp "$2"
ksh-update-completions
else
echo "First argument should be a category."
fi
}
ytdl() {
if [ ! -z $2 ]
then
mkdir -p "$HOME/Videos/YouTube/$1/"
cd "$HOME/Videos/YouTube/$1/" \
&& yt-dlp -o '%(upload_date)s - %(title)s.%(ext)s' "$2"
ksh-update-completions
else
echo "First argument should be a category."
fi
}