summaryrefslogtreecommitdiffstats
path: root/clerk_rating_client
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 /clerk_rating_client
parente6c7ef77f85e92936d34b603f8a320a910e98fba (diff)
downloadperl-app-clerk-a209ed723a772d101df6216911d03b9fb4f7d97a.tar.gz
perl-app-clerk-a209ed723a772d101df6216911d03b9fb4f7d97a.tar.xz
add ability to store ratings in file tags
Diffstat (limited to 'clerk_rating_client')
-rwxr-xr-xclerk_rating_client18
1 files changed, 11 insertions, 7 deletions
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";