aboutsummaryrefslogtreecommitdiff
path: root/local/bin/tag-music
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2021-02-24 17:07:33 +0100
committerCharles Cabergs <me@cacharle.xyz>2021-02-24 17:07:33 +0100
commit468a789dbc4b1928c035d8590895efc533520a27 (patch)
tree74cb056c37eaa50cd50491a7665608488ed4feb1 /local/bin/tag-music
parentf9883d2c3b3699d91e98feeffd7eece546f7c57e (diff)
downloaddotfiles-468a789dbc4b1928c035d8590895efc533520a27.tar.gz
dotfiles-468a789dbc4b1928c035d8590895efc533520a27.tar.bz2
dotfiles-468a789dbc4b1928c035d8590895efc533520a27.zip
Updated file tree to match XDG base directory specification
Diffstat (limited to 'local/bin/tag-music')
-rwxr-xr-xlocal/bin/tag-music32
1 files changed, 32 insertions, 0 deletions
diff --git a/local/bin/tag-music b/local/bin/tag-music
new file mode 100755
index 0000000..826a83a
--- /dev/null
+++ b/local/bin/tag-music
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+music_dir="$HOME/Music"
+
+for artist_dir in "$music_dir"/*
+do
+ [ ! -d "$artist_dir" ] && continue
+ artist="$(basename "$artist_dir")"
+ [ "$artist" = backup ] && continue
+
+ for album_dir in "$artist_dir"/*
+ do
+ album="$(basename "$album_dir")"
+ [ ! -d "$album_dir" ] && continue
+
+ for song_file in "$album_dir"/*
+ do
+ [ ! -f "$song_file" ] && continue
+ song="$(basename "$song_file" | rev | cut -d '.' -f 2- | rev)"
+ # echo $song_file
+ track=0
+ if expr "$song" : "[0-9][0-9]*\-.*" > /dev/null
+ then
+ track="$(echo "$song" | cut -d '-' -f 1)"
+ song="$(echo "$song" | cut -d '-' -f 2-)"
+ fi
+ # echo $track $song
+ # echo $song_file
+ taffy --artist "$artist" --album "$album" --title "$song" --track "$track" "$song_file"
+ done
+ done
+done