From 2dddc3b31a08751f50a6ddfc0144c08b67bed314 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 28 Jun 2015 20:05:13 +0200 Subject: [PATCH] server: Add mood methods image_id and lyrics_id. 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 | 18 ++++++++++++++++++ web/manual.m4 | 5 +++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/mm.c b/mm.c index d6f3573c..92856ec3 100644 --- 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} }; diff --git a/web/manual.m4 b/web/manual.m4 index 0963306e..88e31169 100644 --- a/web/manual.m4 +++ b/web/manual.m4 @@ -956,12 +956,13 @@ is not set, the empty string is matched against the pattern. frequency ~ channels ~ num_played ~ + image_id ~ + lyrics_id ~ Takes a comparator ~ of the set {<, =, <=, >, >=, !=} and a number . Matches an audio file iff the condition ~ 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 -- 2.39.2