diff options
author | waker <wakeroid@gmail.com> | 2011-03-29 21:59:31 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-03-29 21:59:31 +0200 |
commit | 76e84be8041bd5b2641a76b4543d6dc86f3809c4 (patch) | |
tree | 0807dd3eee010ac1ca19255593d6d3f1ccbcf0f8 /playlist.c | |
parent | 819d7fbff263c773ac6660edfc2a404add959086 (diff) |
added plugin-based playlist exporting
Diffstat (limited to 'playlist.c')
-rw-r--r-- | playlist.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -1922,14 +1922,34 @@ pl_crop_selected (void) { int pl_save (const char *fname) { + GLOBAL_LOCK; + const char *ext = strrchr (fname, '.'); + if (ext) { + DB_playlist_t **plug = deadbeef->plug_get_playlist_list (); + for (int i = 0; plug[i]; i++) { + if (plug[i]->extensions && plug[i]->load) { + const char **exts = plug[i]->extensions; + if (exts && plug[i]->save) { + for (int e = 0; exts[e]; e++) { + if (!strcasecmp (exts[e], ext+1)) { + int res = plug[i]->save (fname, (DB_playItem_t *)playlist->head[PL_MAIN], NULL); + GLOBAL_UNLOCK; + return res; + } + } + } + } + } + } + const char magic[] = "DBPL"; uint8_t majorver = PLAYLIST_MAJOR_VER; uint8_t minorver = PLAYLIST_MINOR_VER; FILE *fp = fopen (fname, "w+b"); if (!fp) { + GLOBAL_UNLOCK; return -1; } - GLOBAL_LOCK; if (fwrite (magic, 1, 4, fp) != 4) { goto save_fail; } |