diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2021-03-17 10:55:43 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2021-03-17 10:55:43 +0100 |
commit | 7ffc1a5efee20ae7a778dd1482f16e193cc1f620 (patch) | |
tree | a00ae44447ec46600c96074610cc230a08346e49 /recording.c | |
parent | 36a833053b4b1d51ffe51ca75d06478819e92eeb (diff) | |
download | vdr-7ffc1a5efee20ae7a778dd1482f16e193cc1f620.tar.gz vdr-7ffc1a5efee20ae7a778dd1482f16e193cc1f620.tar.bz2 |
Made checking for done recordings more tolerant
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/recording.c b/recording.c index c1baf54e..f53d4910 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 5.5 2021/01/19 20:38:28 kls Exp $ + * $Id: recording.c 5.6 2021/03/17 10:55:43 kls Exp $ */ #include "recording.h" @@ -3115,9 +3115,32 @@ void cDoneRecordings::Append(const char *Title) } } +static const char *FuzzyChars = " -:"; + +static const char *SkipFuzzyChars(const char *s) +{ + while (*s && strchr(FuzzyChars, *s)) + s++; + return s; +} + bool cDoneRecordings::Contains(const char *Title) const { - return doneRecordings.Find(Title) >= 0; + for (int i = 0; i < doneRecordings.Size(); i++) { + const char *s = doneRecordings[i]; + const char *t = Title; + while (*s && *t) { + s = SkipFuzzyChars(s); + t = SkipFuzzyChars(t); + if (*s != *t) + break; + s++; + t++; + } + if (!*s && !*t) + return true; + } + return false; } // --- Index stuff ----------------------------------------------------------- |