summaryrefslogtreecommitdiffstats
path: root/clerk
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2014-08-24 18:45:08 +0200
committerRasmus Steinke <rasi@xssn.at>2014-08-24 18:45:08 +0200
commitc824a4dc54ce9af0f0ed235832329e9cd007cc47 (patch)
treef23123e9990fa3fb4847be6dd373801ef118bd47 /clerk
parent404ea928667d40600f2535f26aee3069c1b8a0e1 (diff)
downloadperl-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--clerk29
1 files changed, 19 insertions, 10 deletions
diff --git a/clerk b/clerk
index f107950..e01af25 100644
--- a/clerk
+++ b/clerk
@@ -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
}