summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2017-10-20 20:50:12 +0200
committerRasmus Steinke <rasi@xssn.at>2017-10-20 20:50:12 +0200
commit59a02d5931bb9849997de7f60f5798ac6b8e865d (patch)
treefbb2a599b6adb03274b35f439d4bf08fb18f95bf
parentbd1b3f9b92775ce14d9562ea270fb3b368c77bd7 (diff)
downloadclerk-next.tar.gz
clerk-next.tar.bz2
add ogg rating support, fix random tracks ignoreing randomartist settingnext
-rwxr-xr-xclerk.pl4
-rwxr-xr-xclerk_rating_client14
2 files changed, 15 insertions, 3 deletions
diff --git a/clerk.pl b/clerk.pl
index 26d8cbd..cf37439 100755
--- a/clerk.pl
+++ b/clerk.pl
@@ -311,9 +311,9 @@ sub random_tracks {
for (my $i=1; $i <= $rvar{songs}; $i++) {
my @artists = $mpd->list($rvar{randomartist});
my $artist_r = $artists[rand @artists];
- my @albums = $mpd->list('album', 'artist', $artist_r);
+ my @albums = $mpd->list('album', $rvar{randomartist}, $artist_r);
my $album_r = $albums[rand @albums];
- my @tracks = $mpd->find('artist', $artist_r, 'album', $album_r);
+ my @tracks = $mpd->find($rvar{randomartist}, $artist_r, 'album', $album_r);
my $track_r = $tracks[rand @tracks];
my $foo = $track_r->{uri};
$mpd->add($foo);
diff --git a/clerk_rating_client b/clerk_rating_client
index 15f51d3..10efc19 100755
--- a/clerk_rating_client
+++ b/clerk_rating_client
@@ -109,7 +109,19 @@ sub tag_mp3s {
}
sub tag_oggs {
- print STDERR "!! OGG files not supported, yet\n";
+ my ($uri, $mode, $rating, $artist, $albumartist, $title, $album) = @_;
+ my @values = `vorbiscomment $uri`;
+ if ($mode eq "rating") {
+ print ":: tagging track \"${title}\" by \"${artist}\" with rating of \"${rating}\"\n";
+ @values = map {/^RATING/? "RATING=$rating" : $_ } @values;
+ } elsif ($mode eq "albumrating") {
+ print ":: tagging track \"${title}\" by \"${albumartist}\" with albumrating of \"${rating}\"\n";
+ @values = map {/^ALBUMRATING/? "ALBUMRATING=$rating" : $_ } @values;
+ }
+ system('vorbiscomment', '-c', '/dev/null', '-w', $uri);
+ for my $vorbiscomment (@values) {
+ system('vorbiscomment', '-a', '-t', $vorbiscomment, $uri);
+ }
}
sub sync_ratings {