diff options
-rw-r--r-- | clerk | 40 |
1 files changed, 21 insertions, 19 deletions
@@ -683,6 +683,7 @@ escapeSql() { rateAlbum () { artist="$(mpc current -f %artist%)" + albumartist=$(mpc current -f %albumartist%) album="$(mpc current -f %album%)" date="$(mpc current -f %date%)" directory="$(dirname "$(mpc current -f %file%)")" @@ -697,30 +698,30 @@ rateAlbum () { exit else cd $HOME/.config/clerk/ratings - if [[ -a "$(mpc current -f %artist%--%date%--%album%).ratings" ]]; then + if [[ -a "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" ]]; then echo "Ratings file present, using it" else - echo "artist="$(mpc current --format %artist%)"" >> "$(mpc current -f %artist%--%date%--%album%).ratings" - echo "album="$(mpc current --format %album%)"" >> "$(mpc current -f %artist%--%date%--%album%).ratings" - echo "date="$(mpc current --format %date%)"" >> "$(mpc current -f %artist%--%date%--%album%).ratings" - echo "directory="$(dirname "$(mpc current --format %file%)")"" >> "$(mpc current -f %artist%--%date%--%album%).ratings" + echo "artist="$(mpc current --format %artist%)"" >> "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" + echo "album="$(mpc current --format %album%)"" >> "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" + echo "date="$(mpc current --format %date%)"" >> "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" + echo "directory="$(dirname "$(mpc current --format %file%)")"" >> "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" fi if grep "album_rating=" "$(mpc current -f %artist%--%date%--%album%).ratings" > /dev/null; then - sed -i "/album_rating/d" "$(mpc current -f %artist%--%date%--%album%).ratings" + sed -i "/album_rating/d" "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" echo "Album already rated. Changing Rating" fi - echo "album_rating=$ratings/$maxratings" >> "$(mpc current -f %artist%--%date%--%album%).ratings" + echo "album_rating=$ratings/$maxratings" >> "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" if [[ "$music_dir_access" == "yes" ]]; then cd "$music_path" cd "$(dirname "$(mpc current -f %file%)")" if [[ "$(pwd)" == */"$cd_divider"* ]]; then cd .. fi - cp $HOME/.config/clerk/ratings/"$(mpc current -f %artist%--%date%--%album%).ratings" . + cp $HOME/.config/clerk/ratings/"$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" . fi cd $HOME/.config/clerk/ratings notify-send "clerk" "Rated $(mpc current -f "%$mpd_artist% - %album%") with $rating" - sqlite3 ../ratings.db "insert or replace into albums (date, artist, album, directory, rating) values ('$date', '$artist', '$album', '$directory', '$rating')" + sqlite3 ../ratings.db "insert or replace into albums (date, artist, album, directory, rating) values ('$date', '$mpd_artist', '$album', '$directory', '$rating')" fi ratingPrompt } @@ -728,6 +729,7 @@ rateAlbum () { rateTrack () { artist="$(mpc current -f %artist%)" album="$(mpc current -f %album%)" + albumartist="$(mpc current -f %albumartist%)" date="$(mpc current -f %date%)" directory="$(dirname "$(mpc current -f %file%)")" file="$(mpc current -f %file% | awk -F '/' '{ print $NF }')" @@ -744,19 +746,19 @@ rateTrack () { cur_artist="$(mpc current -f %artist%)" cur_file="$(basename "$(mpc current -f %file%)")" cd $HOME/.config/clerk/ratings - if [[ -a "$(mpc current -f %artist%--%date%--%album%).ratings" ]]; then + if [[ -a "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" ]]; then echo "Ratings file present, using it" else - echo "artist="$(mpc current --format %artist%)"" >> "$(mpc current -f %artist%--%date%--%album%).ratings" - echo "album="$(mpc current --format %album%)"" >> "$(mpc current -f %artist%--%date%--%album%).ratings" - echo "date="$(mpc current --format %date%)"" >> "$(mpc current -f %artist%--%date%--%album%).ratings" - echo "directory="$(dirname "$(mpc current --format %file%)")"" >> "$(mpc current -f %artist%--%date%--%album%).ratings" + echo "artist="$(mpc current --format %artist%)"" >> "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" + echo "album="$(mpc current --format %album%)"" >> "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" + echo "date="$(mpc current --format %date%)"" >> "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" + echo "directory="$(dirname "$(mpc current --format %file%)")"" >> "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" fi - if grep "$cur_file" "$(mpc current -f %artist%--%date%--%album%).ratings" > /dev/null; then - sed -i "/$cur_file/d" "$(mpc current -f %artist%--%date%--%album%).ratings" + if grep "$cur_file" "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" > /dev/null; then + sed -i "/$cur_file/d" "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" echo "File already rated. Changing Rating..." fi - echo "rating=$rating/$track_maxratings $(echo "$cur_file")" >> "$(mpc current -f %artist%--%date%--%album%).ratings" + echo "rating=$rating/$track_maxratings $(echo "$cur_file")" >> "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" fi if [[ "$music_dir_access" == "yes" ]]; then cd "$music_path" @@ -764,10 +766,10 @@ rateTrack () { if [[ "$(pwd)" == */"$cd_divider"* ]]; then cd .. fi - cp $HOME/.config/clerk/ratings/"$(mpc current -f %artist%--%date%--%album%).ratings" . + cp $HOME/.config/clerk/ratings/"$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" . fi cd $HOME/.config/clerk/ratings - notify-send "clerk" "Rated $(mpc current -f "%$mpd_artist% - %title%") with $rating" + notify-send "clerk" "Rated $(mpc current -f "%artist% - %title%") with $rating" sqlite3 ../ratings.db "insert or replace into tracks (date, artist, album, directory, rating) values ('$date', '$artist', '$album', '$directory/$file', '$rating')" ratingPrompt } |