summaryrefslogtreecommitdiff
path: root/songgrab
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2022-08-30 08:12:07 -0500
committerzachir <zachir@librem.one>2022-08-30 08:12:07 -0500
commit609b70596fdfec97ca341936f68e96443ae86308 (patch)
tree36c6b835a69e1f42567a88d0c631cae99ea9470b /songgrab
parent794bb7296982776183c5819351aca94aee4231a2 (diff)
add notifications in songgrab
Diffstat (limited to 'songgrab')
-rwxr-xr-xsonggrab36
1 files changed, 29 insertions, 7 deletions
diff --git a/songgrab b/songgrab
index 914a56b..e96861c 100755
--- a/songgrab
+++ b/songgrab
@@ -45,24 +45,32 @@ done
ARTIST=`echo $ARTIST | sed 's/^ //'`
ALBUM=`echo $ALBUM | sed 's/^ //'`
TITLE=`echo $TITLE | sed 's/^ //'`
-echo "Artist: $ARTIST
+printf "Received Tags:
+Artist: $ARTIST
Album: $ALBUM
Song: $TITLE
Number: $TRACKNUM
-Year: $YEAR"
+Year: $YEAR\n\n"
+notify-send "songgrab started" "Received Tags:
+Album: $ALBUM
+Song: $TITLE
+Number: $TRACKNUM
+Year: $YEAR\n\n"
+
+printf "\n"
# prompt to determine later tagging
if [ -z "$SPLITTER_SELECTION" ]; then
- echo -n "Will the link be for a [p]laylist, a[l]bum video, or [s]ong video? "
+ printf "Will the link be for a [p]laylist, a[l]bum video, or [s]ong video? "
read SPLITTER_SELECTION
- echo ""
+ printf "\n"
fi
# prompt to get the URL
if [ -z "$URL" ]; then
- echo -n "Enter the link: "
+ printf "Enter the link: "
read URL
- echo ""
+ printf "\n"
fi
# if song, don't download playlist
@@ -71,9 +79,14 @@ if [ "$SPLITTER_SELECTION" = "s" ]; then
fi
# download the video(s)
+notify-send "songgrab" "Starting download..."
+printf "Starting download..."
ls | grep -q "$(echo $URL | cut -d'=' -f2 | cut -d'&' -f1)" && echo "Already downloaded" || youtube-dl $SPLITTER_FLAGS --format bestaudio --restrict-filenames "$URL"
+notify-send "songgrab" "Download stopped."
+printf "Download stopped."
# while loop to remove files from list
+printf "Do you want to remove any tracks?\n\n"
while true; do
ls | nl
echo -n "Enter the line number: "
@@ -82,11 +95,16 @@ while true; do
rm -rf `ls | head -n "$WHILE_RESPONSE" | tail -1`
done
-# convert the m4a files to mp3
+# convert the downloaded files to mp3
+printf "Starting to convert files..."
+notify-send "songgrab" "Starting to convert files..."
for i in `ls *.m4a *.webm`; do
imp3=`echo "$i" | sed 's/\.m4a$/.mp3/;s/\.webm$/.mp3/'`
+ notify-send "songgrab" "Converting $i to $imp3"
[ ! -f "$imp3" ] && ffmpeg -i "$i" -acodec mp3 "$imp3" || echo "File not converted"
done
+printf "Finished converting files.\n\n"
+notify-send "songgrab" "Finished converting files."
# fix names for suggestions
vimv
@@ -100,6 +118,10 @@ FLAGS=""
[ -n "$YEAR" ] && FLAGS="$FLAGS -y $YEAR"
# tag songs with tagmp3
+notify-send "songgrab" "Tagging songs..."
+printf "Tagging songs..."
for i in `ls *.mp3`; do
tagmp3 $FLAGS "$i"
done
+notify-send "songgrab" "Done."
+printf "Done.\n\n"