summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2010-12-05 16:07:59 +0100
committerGravatar waker <wakeroid@gmail.com>2010-12-05 16:07:59 +0100
commit92aa0e95f1d2f006acc8ebaf4c4451a854d2d0ec (patch)
tree4115b70c71b13a2b7686e64e83e07c6f768512f9 /playlist.c
parent3629cd4e9959093cd38fc630604d04dce93eda6c (diff)
added support for filetype prefix-test (for uade2 mod.title files); some code cleanup
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/playlist.c b/playlist.c
index c16df84b..25472bb4 100644
--- a/playlist.c
+++ b/playlist.c
@@ -1289,12 +1289,20 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla
}
// detect decoder
- const char *eol = fname + strlen (fname) - 1;
- while (eol > fname && *eol != '.') {
- eol--;
+ const char *eol = strrchr (fname, '.');
+ if (!eol) {
+ return NULL;
}
eol++;
+ const char *fn = strrchr (fname, '/');
+ if (!fn) {
+ fn = fname;
+ }
+ else {
+ fn++;
+ }
+
// detect pls/m3u files
// they must be handled before checking for http://,
// so that remote playlist files referenced from other playlist files could
@@ -1370,6 +1378,20 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla
}
}
}
+ if (decoders[i]->prefixes && decoders[i]->insert) {
+ const char **prefixes = decoders[i]->prefixes;
+ for (int e = 0; prefixes[e]; e++) {
+ if (!strncasecmp (prefixes[e], fn, strlen(prefixes[e])) && *(fn + strlen (prefixes[e])) == '.') {
+ playItem_t *inserted = (playItem_t *)decoders[i]->insert (DB_PLAYITEM (after), fname);
+ if (inserted != NULL) {
+ if (cb && cb (inserted, user_data) < 0) {
+ *pabort = 1;
+ }
+ return inserted;
+ }
+ }
+ }
+ }
}
trace ("no decoder found for %s\n", fname);
return NULL;