Introduction
Introduction Statistics Contact Development Disclaimer Help
Fix yt-dlp output and adding to queue. - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit 41ec9fc9977fde61417488d0746553f50ec34288
parent f850abb402021106be62251faaab4b6592f7c614
Author: Annna Robert-Houdin <[email protected]>
Date: Sat, 10 Aug 2024 11:08:12 +0200
Fix yt-dlp output and adding to queue.
Diffstat:
M ytdl-mpd | 37 ++++++++++++++++-------------…
1 file changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/ytdl-mpd b/ytdl-mpd
@@ -41,7 +41,7 @@ handle_url() {
mkdir -p "$outputdir"
cd "$outputdir"
- album="$(ytdl "$1" | tee /dev/tty | grep 'Finished downloading' | sed …
+ album="$(ytdl "$1" | grep 'Finished downloading' | sed 's/.*: //')"
if [ $? -ne 0 ]; then
die "youtube-dl error"
@@ -82,11 +82,12 @@ handle_url() {
artist="$(printf '%s' "$f" | \
awk -F'-' '{gsub(/^ +/, "", $2); gsub(/ +$/, "…
- printf 'file: %s\n' "$f"
song=$(printf '%s' "$f" | sed 's/.* - //; s/^ //; s/\.mp3//')
if [ "$auto" = 0 ]; then
+ printf 'file: %s\n' "$f"
+
printf 'song [%s]: ' "$song"
read
song="${REPLY:-$song}"
@@ -106,28 +107,28 @@ handle_url() {
id3tag --artist="$artist" --album="$album" \
--song="$song" --track="$track" \
- "$f"
+ "$f" 2>&1 >/dev/null
track=$(( track + 1 ))
+
+ if [ "$move_music" = 1 ]; then
+ outdir="$musicroot/$artist/$album"
+ mkdir -p "$outdir"
+ mv "${f}" "$outdir"
+ mpc update --wait >/dev/null
+ if [ "$queue" = 1 ]; then
+ mpc findadd \
+ artist "$artist" \
+ album "$album" \
+ title "$song"
+ fi
+ else
+ mv "${f}" "$oldpwd/"
+ fi
done
IFS=$SAVEIFS
- if [ "$move_music" = 1 ]; then
- outdir="$musicroot/$artist/$album"
- mkdir -p "$outdir"
- mv ./*.mp3 "$outdir"
- mpc update --wait >/dev/null
- if [ "$queue" = 1 ]; then
- mpc findadd \
- artist "$artist" \
- album "$album" \
- title "$song"
- fi
- else
- mv ./*.mp3 "$oldpwd/"
- fi
-
rmdir "$outputdir"
cd - >/dev/null
}
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.