From: Andre Noll Date: Sun, 19 Jul 2009 16:47:23 +0000 (+0200) Subject: Add num_played mood method. X-Git-Tag: v0.4.0~50^2 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=ce840490da9fd68cfee0dcdf719a0915e0aa26c1;p=paraslash.git Add num_played mood method. --- diff --git a/README.afs b/README.afs index edd2d17b..46e30c45 100644 --- a/README.afs +++ b/README.afs @@ -178,18 +178,19 @@ is not set, the empty string is matched against the pattern. bitrate ~ frequency ~ channels ~ + num_played ~ 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 -(bitrate in kbit/s, frequency in Hz, channel count, value of the -year tag). +(value of the year tag, bitrate in kbit/s, frequency in Hz, channel +count, play count). 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 audio files never match. Another difference is the special treatment if the year tag is a two-digit number. In this case either 1900 or -2000 are added to the tag value, depending on whether the number is +2000 are added to the tag value depending on whether the number is greater than 2000 plus the current year. diff --git a/mm.c b/mm.c index 4f76d40f..885b6307 100644 --- a/mm.c +++ b/mm.c @@ -187,6 +187,14 @@ static int mm_channels_score_function(__a_unused const char *path, return mm_compare_num_score_function(afhi->channels, 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, + const void *private) +{ + return mm_compare_num_score_function(afsi->num_played, private); +} + struct mm_year_data { /** Comparator and year given at the mood line. */ struct mm_compare_num_data *cnd; @@ -343,5 +351,6 @@ const struct mood_method mood_methods[] = { {DEFINE_COMPARE_NUM_MOOD_METHOD(bitrate)}, {DEFINE_COMPARE_NUM_MOOD_METHOD(frequency)}, {DEFINE_COMPARE_NUM_MOOD_METHOD(channels)}, + {DEFINE_COMPARE_NUM_MOOD_METHOD(num_played)}, {.parser = NULL} };