playlist_queue: try open by URI first
If that fails, try opening the file as a stream.
This commit is contained in:
parent
032354e65c
commit
216dff98d2
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue