]> git.tue.mpg.de Git - paraslash.git/commitdiff
server: Add mood methods image_id and lyrics_id.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 28 Jun 2015 18:05:13 +0000 (20:05 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 27 Nov 2015 08:19:18 +0000 (09:19 +0100)
This rather simple patch allows to easily define a mood that selects
all files of an album through the image ID, or all versions of a song
(including cover and Live versions) through the lyrics ID.

The documentation is updated to list the two new mood methods.

mm.c
web/manual.m4

diff --git a/mm.c b/mm.c
index d6f3573ce438564f0edbc4c0aafa1a9642470f3d..92856ec3ef903eb905b0379c6eaff605bf6f8d06 100644 (file)
--- a/mm.c
+++ b/mm.c
@@ -191,6 +191,22 @@ static int mm_channels_score_function(__a_unused const char *path,
        return mm_compare_num_score_function(afhi->channels, private);
 }
 
+static int mm_image_id_score_function(__a_unused const char *path,
+               const struct afs_info *afsi,
+               __a_unused const struct afh_info *afhi,
+               const void *private)
+{
+       return mm_compare_num_score_function(afsi->image_id, private);
+}
+
+static int mm_lyrics_id_score_function(__a_unused const char *path,
+               const struct afs_info *afsi,
+               __a_unused const struct afh_info *afhi,
+               const void *private)
+{
+       return mm_compare_num_score_function(afsi->lyrics_id, private);
+}
+
 static int mm_num_played_score_function(__a_unused const char *path,
                const struct afs_info *afsi,
                __a_unused const struct afh_info *afhi,
@@ -356,5 +372,7 @@ const struct mood_method mood_methods[] = {
        {DEFINE_COMPARE_NUM_MOOD_METHOD(frequency)},
        {DEFINE_COMPARE_NUM_MOOD_METHOD(channels)},
        {DEFINE_COMPARE_NUM_MOOD_METHOD(num_played)},
+       {DEFINE_COMPARE_NUM_MOOD_METHOD(image_id)},
+       {DEFINE_COMPARE_NUM_MOOD_METHOD(lyrics_id)},
        {.parser = NULL}
 };
index 0963306e226bf3bdbd7e03ba591a8cfc970c2946..88e31169325daae526a09087b834e9bc5a3646a3 100644 (file)
@@ -956,12 +956,13 @@ is not set, the empty string is matched against the pattern.
        frequency ~ <num>
        channels ~ <num>
        num_played ~ <num>
+       image_id ~ <num>
+       lyrics_id ~ <num>
 
 Takes a comparator ~ of the set {<, =, <=, >, >=, !=} and a number
 <num>. Matches an audio file iff the condition <val> ~ <num> is
 satisfied where val is the corresponding value of the audio file
-(value of the year tag, bitrate in kbit/s, frequency in Hz, channel
-count, play count).
+(value of the year tag, bitrate in kbit/s, etc.).
 
 The year tag is special as its value is undefined if the audio file
 has no year tag or the content of the year tag is not a number. Such