rename mp3.c to mp3_afh.c and ogg.c to ogg_afh.c
[paraslash.git] / db.c
diff --git a/db.c b/db.c
index cb6f692..9db622b 100644 (file)
--- a/db.c
+++ b/db.c
 #include "error.h"
 #include "string.h"
 
-/*
- * return 1 if name matches any supported audio format
- */
-static int match_audio_file_name(char *name)
-{
-       int i,j, len = strlen(name);
-
-       FOR_EACH_AUDIO_FORMAT(i) {
-               for (j = 0; afl[i].suffixes[j]; j++) {
-                       const char *p = afl[i].suffixes[j];
-                       int plen = strlen(p);
-                       if (len < plen + 1)
-                               continue;
-                       if (name[len - plen - 1] != '.')
-                               continue;
-                       if (strcasecmp(name + len - plen, p))
-                               continue;
-                       return 1;
-               }
-       }
-       return 0;
-}
-
 /**
  * traverse the given directory recursively
  *
@@ -103,7 +80,7 @@ int find_audio_files(const char *dirname, int (*f)(const char *, const char *))
                if (!S_ISREG(m) && !S_ISDIR(m)) /* skip links, sockets, ... */
                        continue;
                if (S_ISREG(m)) { /* regular file */
-                       if (!match_audio_file_name(entry->d_name))
+                       if (guess_audio_format(entry->d_name) < 0)
                                continue;
                        if (f(dirname, entry->d_name) < 0)
                                goto out;