diff options
Diffstat (limited to 'apps/metadata.c')
-rw-r--r-- | apps/metadata.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/apps/metadata.c b/apps/metadata.c index 47c0e7449b..da20a0df2b 100644 --- a/apps/metadata.c +++ b/apps/metadata.c | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include "debug.h" | 26 | #include "debug.h" |
27 | #include "logf.h" | 27 | #include "logf.h" |
28 | #include "settings.h" | ||
28 | #include "cuesheet.h" | 29 | #include "cuesheet.h" |
29 | #include "metadata.h" | 30 | #include "metadata.h" |
30 | 31 | ||
@@ -425,3 +426,49 @@ void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig) | |||
425 | memcpy(dest, orig, sizeof(struct mp3entry)); | 426 | memcpy(dest, orig, sizeof(struct mp3entry)); |
426 | adjust_mp3entry(dest, dest, orig); | 427 | adjust_mp3entry(dest, dest, orig); |
427 | } | 428 | } |
429 | |||
430 | #ifdef HAVE_TAGCACHE | ||
431 | #if CONFIG_CODEC == SWCODEC | ||
432 | |||
433 | enum { AUTORESUMABLE_UNKNOWN = 0, AUTORESUMABLE_TRUE, AUTORESUMABLE_FALSE }; | ||
434 | |||
435 | bool autoresumable(struct mp3entry *id3) | ||
436 | { | ||
437 | unsigned char search[MAX_PATHNAME+1]; | ||
438 | char *saveptr, *substr; | ||
439 | bool is_resumable; | ||
440 | |||
441 | if (id3->autoresumable) /* result cached? */ | ||
442 | return id3->autoresumable == AUTORESUMABLE_TRUE; | ||
443 | |||
444 | is_resumable = true; | ||
445 | |||
446 | strcpy(search, global_settings.autoresume_strpat); | ||
447 | |||
448 | for (substr = strtok_r(search, ",", &saveptr); | ||
449 | substr; | ||
450 | substr = strtok_r(NULL, ",", &saveptr)) | ||
451 | { | ||
452 | if (id3->path && strcasestr(id3->path, substr)) | ||
453 | goto out; | ||
454 | if (id3->genre_string && strcasestr(id3->genre_string, substr)) | ||
455 | goto out; | ||
456 | } | ||
457 | |||
458 | is_resumable = false; | ||
459 | |||
460 | out: | ||
461 | /* cache result */ | ||
462 | id3->autoresumable = | ||
463 | is_resumable ? AUTORESUMABLE_TRUE : AUTORESUMABLE_FALSE; | ||
464 | |||
465 | logf("autoresumable: %s with genre %s is%s resumable", | ||
466 | id3->path, | ||
467 | id3->genre_string ? id3->genre_string : "(NULL)", | ||
468 | is_resumable ? "" : " not"); | ||
469 | |||
470 | return is_resumable; | ||
471 | } | ||
472 | |||
473 | #endif /* SWCODEC */ | ||
474 | #endif /* HAVE_TAGCACHE */ | ||