summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2017-09-30 18:38:07 +0200
committerRasmus Steinke <rasi@xssn.at>2017-09-30 18:38:07 +0200
commita209ed723a772d101df6216911d03b9fb4f7d97a (patch)
tree807e173465d68901d1c38dfad3127de21d6c9511
parente6c7ef77f85e92936d34b603f8a320a910e98fba (diff)
downloadperl-app-clerk-a209ed723a772d101df6216911d03b9fb4f7d97a.tar.gz
perl-app-clerk-a209ed723a772d101df6216911d03b9fb4f7d97a.tar.xz
add ability to store ratings in file tags
-rw-r--r--clerk.conf10
-rwxr-xr-xclerk_rating_client18
2 files changed, 17 insertions, 11 deletions
diff --git a/clerk.conf b/clerk.conf
index e28962b..9cd3449 100644
--- a/clerk.conf
+++ b/clerk.conf
@@ -2,6 +2,9 @@
# MPD_HOST will override this
mpd_host=localhost
+# music root for rating_client
+music_root=/mnt/Music
+
# define file paths
database=PLACEHOLDER/.config/clerk/database.mpk
tmux_config=PLACEHOLDER/.config/clerk/clerk.tmux
@@ -15,10 +18,9 @@ songs=20
# if mpd drops the connection while updating, reduce this.
chunksize=30000
-# rofi theme to use for clerk
-rofi_theme=clerk
-
-jump_query=0
+# write tags to audio files. Needs running clerk_rating_client on machine with audio files
+# ratings will always be written to sticker database.
+tagging=false
[Columns]
# width of columns
diff --git a/clerk_rating_client b/clerk_rating_client
index b05bc2b..bb63a3a 100755
--- a/clerk_rating_client
+++ b/clerk_rating_client
@@ -62,21 +62,25 @@ sub track_rating {
my $title = $song_tags[0]->{Title};
my $album = $song_tags[0]->{Album};
if ($uri =~ /.*.flac$/) {
- if ($mode eq "RATING") {
+ if ($mode eq "rating") {
print ":: tagging track \"${title}\" by \"${artist}\" with rating of \"${rating}\"\n";
- } elsif ($mode eq "ALBUMRATING") {
+ system('metaflac', '--remove-tag=RATING', "${music_root}/${uri}");
+ system('metaflac', "--set-tag=RATING=${rating}", "${music_root}/${uri}");
+ } elsif ($mode eq "albumrating") {
print ":: tagging track \"${title}\" by \"${albumartist}\" with albumrating of \"${rating}\"\n";
+ system('metaflac', '--remove-tag=ALBUMRATING', "${music_root}/${uri}");
+ system('metaflac', "--set-tag=ALBUMRATING=${rating}", "${music_root}/${uri}");
}
- system('metaflac', '--remove-tag=RATING', "${music_root}/${uri}");
- system('metaflac', "--set-tag=${mode}=${rating}", "${music_root}/${uri}");
}
elsif ($uri =~ /.*.mp3$/) {
- if ($mode eq "RATING") {
+ if ($mode eq "rating") {
print ":: tagging track \"${title}\" by \"${artist}\" with rating of \"${rating}\"\n";
- } elsif ($mode eq "ALBUMRATING") {
+ system('mid3v2', "--TXXX", "RATING:${rating}", "${music_root}/${uri}");
+
+ } elsif ($mode eq "albumrating") {
print ":: tagging track \"${title}\" by \"${albumartist}\" with albumrating of \"${rating}\"\n";
+ system('mid3v2', "--TXXX", "ALBUMRATING:${rating}", "${music_root}/${uri}");
}
- system('mid3v2', "--TXXX", "${mode}:${rating}", "${music_root}/${uri}");
}
elsif ($uri =~ /.*.ogg$/) {
print "!! OGG files not supported, yet\n";