From 12045f8ec85fbef17497be4f12799cc714aa9980 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Tue, 4 Feb 2025 03:43:09 +0900 Subject: modified bin/qndl --- ar/.local/bin/qndl | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ar/.local/bin/qndl b/ar/.local/bin/qndl index afcd16e..54490d6 100755 --- a/ar/.local/bin/qndl +++ b/ar/.local/bin/qndl @@ -18,6 +18,21 @@ while getopts "mvr" opt; do YTDL_OUTPUT_FORMAT="${OUTPUT_DIR}/%(artist|)s%(artist& - |)s%(title)s.%(ext)s" YTDL_CMD_BASE="$YTDL_CMD_BASE --audio-format best --audio-quality 0 --download-archive \"$ARCHIVE_FILE\" --extract-audio --recode-video mp3" ;; + r) + OUTPUT_DIR="${XDG_MUSIC_DIR:-${HOME}/Music}" + ARCHIVE_FILE="${XDG_DOTFILES_DIR:-${HOME}/.dotfiles}/default/Music/.music.txt" + YTDL_OUTPUT_FORMAT="${OUTPUT_DIR}/%(artist|)s%(artist& - |)s%(title)s.%(ext)s" + YTDL_CMD_BASE="$YTDL_CMD_BASE --audio-format best --audio-quality 0 --extract-audio --recode-video mp3" + YTDL_CMD="$YTDL_CMD_BASE --output \"$YTDL_OUTPUT_FORMAT\"" + [ ! -f "$ARCHIVE_FILE" ] && exit 1 + while read -r line; do + video_id=$(echo "$line" | awk '{print $2}') + YTDL_CMD="$YTDL_CMD_BASE --output \"$YTDL_OUTPUT_FORMAT\" \"https://www.youtube.com/watch?v=$video_id\"" + idnum=$(tsp bash -c "$YTDL_CMD") + pkill -RTMIN+21 "${STATUSBAR:-dwmblocks}" + done <"$ARCHIVE_FILE" + exit 0 + ;; v) DOWNLOAD_TYPE="video" OUTPUT_DIR="${XDG_VIDEOS_DIR:-${HOME}/Videos}" @@ -43,21 +58,6 @@ while getopts "mvr" opt; do esac YTDL_CMD_BASE="$YTDL_CMD_BASE --buffer-size 1M --embed-thumbnail $VIDEO_FORMATS --no-sponsorblock $VIDEO_OPTIONS" ;; - r) - OUTPUT_DIR="${XDG_MUSIC_DIR:-${HOME}/Music}" - ARCHIVE_FILE="${XDG_DOTFILES_DIR:-${HOME}/.dotfiles}/default/Music/.music.txt" - YTDL_OUTPUT_FORMAT="${OUTPUT_DIR}/%(artist|)s%(artist& - |)s%(title)s.%(ext)s" - YTDL_CMD_BASE="$YTDL_CMD_BASE --audio-format best --audio-quality 0 --extract-audio --recode-video mp3" - YTDL_CMD="$YTDL_CMD_BASE --output \"$YTDL_OUTPUT_FORMAT\"" - [ ! -f "$ARCHIVE_FILE" ] && exit 1 - while read -r line; do - video_id=$(echo "$line" | awk '{print $2}') - YTDL_CMD="$YTDL_CMD_BASE --output \"$YTDL_OUTPUT_FORMAT\" \"https://www.youtube.com/watch?v=$video_id\"" - idnum=$(tsp bash -c "$YTDL_CMD") - pkill -RTMIN+21 "${STATUSBAR:-dwmblocks}" - done <"$ARCHIVE_FILE" - exit 0 - ;; *) notify-send "⛔ Invalid option: -$OPTARG" exit 1 -- cgit v1.2.3