Skip to content

Commit

Permalink
Add playlist detection and ask to remove it...
Browse files Browse the repository at this point in the history
  • Loading branch information
ledav-net committed Aug 17, 2024
1 parent 1f9eebf commit 7be4c42
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions youtube-mp3
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,18 @@ d=${1:-$(zenity --entry --width=1000)} || exit 1

[ -z "$d" ] && exit 1

title=$(youtube-dl --verbose --get-title "$d")
if [[ "$d" =~ [\?\&]list=.* ]]; then
if zenity --question --ok-label="Drop" --cancel-label="Keep going" --text="Playlist detected !"
then
d=$(sed 's/[&?]list=.*&\?//' <<< "$d")
[[ "$d" =~ .*\? ]] || d=$(sed 's/\&/\?/' <<< "$d")
fi
fi

notify-send -u low -a youtube-mp3 "Processing" "$d"

title=$($BIN "${BIN_ARGS[@]}" --verbose --get-title "$d")

if [ $? -ne 0 ]; then
# In case you get this ERROR message, just start it on the command
# line and look at the outputs to try to understand and maybe fix
Expand All @@ -32,7 +43,7 @@ if [ $? -ne 0 ]; then
exit 1
fi

notify-send -u low -a youtube-mp3 "Processing ..." "$title"
notify-send -u low -a youtube-mp3 "Downloading" "$title"

mp3=$(\
youtube-dl --extract-audio --audio-format=mp3 --audio-quality=192K "$d" \
Expand Down

0 comments on commit 7be4c42

Please sign in to comment.