diff options
author | Rasmus Steinke <rasi@xssn.at> | 2014-08-24 18:45:08 +0200 |
---|---|---|
committer | Rasmus Steinke <rasi@xssn.at> | 2014-08-24 18:45:08 +0200 |
commit | c824a4dc54ce9af0f0ed235832329e9cd007cc47 (patch) | |
tree | f23123e9990fa3fb4847be6dd373801ef118bd47 /clerk | |
parent | 404ea928667d40600f2535f26aee3069c1b8a0e1 (diff) | |
download | perl-app-clerk-c824a4dc54ce9af0f0ed235832329e9cd007cc47.tar.gz perl-app-clerk-c824a4dc54ce9af0f0ed235832329e9cd007cc47.tar.xz |
write ratings to ratings folder in addition
Diffstat (limited to 'clerk')
-rw-r--r-- | clerk | 29 |
1 files changed, 19 insertions, 10 deletions
@@ -622,11 +622,11 @@ rateAlbum () { cd .. else echo " " fi - rm -f rating.txt - echo "$ratings/$maxratings" > rating.txt - echo "$(mpc current -f "%$mpd_artist%")" >> rating.txt - echo "$(mpc current -f '%album%')" >> rating.txt - echo "$(mpc current -f '%date%')" >> rating.txt + rm -f "$(mpc current -f %artist%--%date%--%album%).albumrating" + echo "$ratings/$maxratings" > "$(mpc current -f %artist%--%date%--%album%).albumrating" + echo "$(mpc current -f "%$mpd_artist%")" >> "$(mpc current -f %artist%--%date%--%album%).albumrating" + echo "$(mpc current -f '%album%')" >> "$(mpc current -f %artist%--%date%--%album%).albumrating" + echo "$(mpc current -f '%date%')" >> "$(mpc current -f %artist%--%date%--%album%).albumrating" notify-send "clerk" "Rated $(mpc current -f "%$mpd_artist% - %album%") with $ratings" fi } @@ -636,14 +636,23 @@ rateTrack () { if [ ratings = "" ]; then exit else - cd "$music_path" - cd "$(dirname "$(mpc current -f %file%)")" + cur_artist="$(mpc current -f %artist%)" cur_file="$(basename "$(mpc current -f %file%)")" - if grep "$cur_file" track_ratings.txt > /dev/null; then - sed -i "/$cur_file/d" track_ratings.txt + if [[ "$music_dir_access" == "yes" ]]; then + cd "$music_path" + cd "$(dirname "$(mpc current -f %file%)")" + if grep "$cur_file" "$(mpc current -f %artist%--%date%--%album%).trackratings" > /dev/null; then + sed -i "/$cur_file/d" "$(mpc current -f %artist%--%date%--%album%).trackratings" + echo "File already rated. Changing Rating..." + fi + echo "$ratings/$track_maxratings $(echo "$cur_file")" >> "$(mpc current -f %artist%--%date%--%album%).trackratings" + fi + cd $HOME/.config/clerk/ratings/flat/tracks + if grep "$cur_file" "$(mpc current -f %artist%--%date%--%album%).trackratings" > /dev/null; then + sed -i "/$cur_file/d" "$(mpc current -f %artist%--%date%--%album%).trackratings" echo "File already rated. Changing Rating..." fi - echo "$ratings/$track_maxratings $(echo "$cur_file")" >> track_ratings.txt + echo "$ratings/$track_maxratings $(echo "$cur_file")" >> "$(mpc current -f %artist%--%date%--%album%).trackratings" notify-send "clerk" "Rated $(mpc current -f "%$mpd_artist% - %title%") with $ratings" fi } |