diff options
author | Rasmus Steinke <rasi@xssn.at> | 2014-08-25 23:48:44 +0200 |
---|---|---|
committer | Rasmus Steinke <rasi@xssn.at> | 2014-08-25 23:48:44 +0200 |
commit | 101fc7aaf11a826c735c83358b92b32e4547ef7c (patch) | |
tree | a0cbca31315bb565968dcb5d93f1fae46b021574 /clerk | |
parent | 236a92c1cafe9fd1f2777cf2c9b6d6a4d77923e1 (diff) | |
download | perl-app-clerk-101fc7aaf11a826c735c83358b92b32e4547ef7c.tar.gz perl-app-clerk-101fc7aaf11a826c735c83358b92b32e4547ef7c.tar.xz |
fix for last commit
Diffstat (limited to 'clerk')
-rw-r--r-- | clerk | 52 |
1 files changed, 30 insertions, 22 deletions
@@ -682,8 +682,12 @@ escapeSql() { } rateAlbum () { - artist="$(mpc current -f %artist%)" - albumartist=$(mpc current -f %albumartist%) + if [[ "$mpd_artist" == "albumartist" ]]; then + albumartist="$(mpc current -f %albumartist%)" + elif [[ "$mpd_artist" == "artist" ]]; then + albumartist="$(mpc current -f %artist%)" + fi + artist="$(mpc format -f %artist%)" album="$(mpc current -f %album%)" date="$(mpc current -f %date%)" directory="$(dirname "$(mpc current -f %file%)")" @@ -698,30 +702,30 @@ rateAlbum () { exit else cd $HOME/.config/clerk/ratings - if [[ -a "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" ]]; then + if [[ -a "$(mpc current -f %$albumartist%--%date%--%album%).ratings" ]]; then echo "Ratings file present, using it" else - 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" + echo "artist="$(mpc current --format %artist%)"" >> "$(mpc current -f %$albumartist%--%date%--%album%).ratings" + echo "album="$(mpc current --format %album%)"" >> "$(mpc current -f %$albumartist%--%date%--%album%).ratings" + echo "date="$(mpc current --format %date%)"" >> "$(mpc current -f %$albumartist%--%date%--%album%).ratings" + echo "directory="$(dirname "$(mpc current --format %file%)")"" >> "$(mpc current -f %$albumartist%--%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 %$mpd_artist%--%date%--%album%).ratings" + sed -i "/album_rating/d" "$(mpc current -f %$albumartist%--%date%--%album%).ratings" echo "Album already rated. Changing Rating" fi - echo "album_rating=$ratings/$maxratings" >> "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" + echo "album_rating=$ratings/$maxratings" >> "$(mpc current -f %$albumartist%--%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 %$mpd_artist%--%date%--%album%).ratings" . + cp $HOME/.config/clerk/ratings/"$(mpc current -f %$albumartist%--%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', '$mpd_artist', '$album', '$directory', '$rating')" + notify-send "clerk" "Rated $(mpc current -f "%$albumartist% - %album%") with $rating" + sqlite3 ../ratings.db "insert or replace into albums (date, artist, album, directory, rating) values ('$date', '$albumartist', '$album', '$directory', '$rating')" fi ratingPrompt } @@ -729,7 +733,11 @@ rateAlbum () { rateTrack () { artist="$(mpc current -f %artist%)" album="$(mpc current -f %album%)" - albumartist="$(mpc current -f %albumartist%)" + if [[ "$mpd_artist" == "albumartist" ]]; then + albumartist="$(mpc current -f %albumartist%)" + elif [[ "$mpd_artist" == "artist" ]]; then + albumartist="$(mpc current -f %artist%)" + fi date="$(mpc current -f %date%)" directory="$(dirname "$(mpc current -f %file%)")" file="$(mpc current -f %file% | awk -F '/' '{ print $NF }')" @@ -746,19 +754,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 %$mpd_artist%--%date%--%album%).ratings" ]]; then + if [[ -a "$(mpc current -f %$albumartist%--%date%--%album%).ratings" ]]; then echo "Ratings file present, using it" else - 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" + echo "artist="$(mpc current --format %artist%)"" >> "$(mpc current -f %$albumartist%--%date%--%album%).ratings" + echo "album="$(mpc current --format %album%)"" >> "$(mpc current -f %$albumartist%--%date%--%album%).ratings" + echo "date="$(mpc current --format %date%)"" >> "$(mpc current -f %$albumartist%--%date%--%album%).ratings" + echo "directory="$(dirname "$(mpc current --format %file%)")"" >> "$(mpc current -f %$albumartist%--%date%--%album%).ratings" fi - 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" + if grep "$cur_file" "$(mpc current -f %$albumartist%--%date%--%album%).ratings" > /dev/null; then + sed -i "/$cur_file/d" "$(mpc current -f %$albumartist%--%date%--%album%).ratings" echo "File already rated. Changing Rating..." fi - echo "rating=$rating/$track_maxratings $(echo "$cur_file")" >> "$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" + echo "rating=$rating/$track_maxratings $(echo "$cur_file")" >> "$(mpc current -f %$albumartist%--%date%--%album%).ratings" fi if [[ "$music_dir_access" == "yes" ]]; then cd "$music_path" @@ -766,7 +774,7 @@ rateTrack () { if [[ "$(pwd)" == */"$cd_divider"* ]]; then cd .. fi - cp $HOME/.config/clerk/ratings/"$(mpc current -f %$mpd_artist%--%date%--%album%).ratings" . + cp $HOME/.config/clerk/ratings/"$(mpc current -f %$albumartist%--%date%--%album%).ratings" . fi cd $HOME/.config/clerk/ratings notify-send "clerk" "Rated $(mpc current -f "%artist% - %title%") with $rating" |