aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist_queue.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/playlist_queue.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/playlist_queue.c b/src/playlist_queue.c
index 5b4439bbb..a184db9f8 100644
--- a/src/playlist_queue.c
+++ b/src/playlist_queue.c
@@ -103,12 +103,30 @@ playlist_open_remote_into_queue(const char *uri, struct playlist *dest)
}
static enum playlist_result
-playlist_open_local_into_queue(const char *uri, struct playlist *dest)
+playlist_open_path_into_queue(char *path_fs, struct playlist *dest)
{
struct playlist_provider *playlist;
+ struct input_stream is;
+ enum playlist_result result;
+
+ if ((playlist = playlist_list_open_uri(path_fs)) != NULL)
+ result = playlist_load_into_queue(playlist, dest);
+ else if ((playlist = playlist_list_open_path(&is, path_fs)) != NULL) {
+ result = playlist_load_into_queue(playlist, dest);
+ input_stream_close(&is);
+ } else
+ return PLAYLIST_RESULT_NO_SUCH_LIST;
+
+ playlist_plugin_close(playlist);
+
+ return result;
+}
+
+static enum playlist_result
+playlist_open_local_into_queue(const char *uri, struct playlist *dest)
+{
const char *playlist_directory_fs;
char *path_fs;
- struct input_stream is;
enum playlist_result result;
assert(spl_valid_name(uri));
@@ -118,15 +136,8 @@ playlist_open_local_into_queue(const char *uri, struct playlist *dest)
return PLAYLIST_RESULT_DISABLED;
path_fs = g_build_filename(playlist_directory_fs, uri, NULL);
- playlist = playlist_list_open_path(&is, path_fs);
+ result = playlist_open_path_into_queue(path_fs, dest);
g_free(path_fs);
- if (playlist == NULL)
- return PLAYLIST_RESULT_NO_SUCH_LIST;
-
- result = playlist_load_into_queue(playlist, dest);
- playlist_plugin_close(playlist);
-
- input_stream_close(&is);
return result;
}