playlist: use uri_has_scheme() instead of isRemoteUrl()
For internal checks (i.e. not in command.c), we need to check whether an URI is in the databse, in the local file system or a remote URI with a scheme.
This commit is contained in:
parent
7d87f71d83
commit
17d8bdb427
@ -565,7 +565,7 @@ song_by_url(const char *url)
|
|||||||
if (song != NULL)
|
if (song != NULL)
|
||||||
return song;
|
return song;
|
||||||
|
|
||||||
if (isRemoteUrl(url))
|
if (uri_has_scheme(url))
|
||||||
return song_remote_new(url);
|
return song_remote_new(url);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -50,7 +50,7 @@ playlist_print_uri(FILE *file, const char *uri)
|
|||||||
char tmp[MPD_PATH_MAX];
|
char tmp[MPD_PATH_MAX];
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (playlist_saveAbsolutePaths && !isRemoteUrl(uri) &&
|
if (playlist_saveAbsolutePaths && !uri_has_scheme(uri) &&
|
||||||
uri[0] != '/')
|
uri[0] != '/')
|
||||||
s = map_uri_fs(uri);
|
s = map_uri_fs(uri);
|
||||||
else
|
else
|
||||||
|
@ -165,7 +165,7 @@ spl_load(const char *utf8path)
|
|||||||
|
|
||||||
g_strchomp(buffer);
|
g_strchomp(buffer);
|
||||||
|
|
||||||
if (!isRemoteUrl(s)) {
|
if (!uri_has_scheme(s)) {
|
||||||
struct song *song;
|
struct song *song;
|
||||||
|
|
||||||
path_utf8 = map_fs_to_utf8(s, path_max_tmp);
|
path_utf8 = map_fs_to_utf8(s, path_max_tmp);
|
||||||
@ -366,21 +366,20 @@ spl_append_uri(const char *url, const char *utf8file)
|
|||||||
{
|
{
|
||||||
struct song *song;
|
struct song *song;
|
||||||
|
|
||||||
song = db_get_song(url);
|
if (uri_has_scheme(url)) {
|
||||||
if (song)
|
enum playlist_result ret;
|
||||||
return spl_append_song(utf8file, song);
|
|
||||||
|
|
||||||
if (!isRemoteUrl(url))
|
song = song_remote_new(url);
|
||||||
return PLAYLIST_RESULT_NO_SUCH_SONG;
|
ret = spl_append_song(utf8file, song);
|
||||||
|
|
||||||
song = song_remote_new(url);
|
|
||||||
if (song) {
|
|
||||||
enum playlist_result ret = spl_append_song(utf8file, song);
|
|
||||||
song_free(song);
|
song_free(song);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
} else {
|
||||||
|
song = db_get_song(url);
|
||||||
|
if (song == NULL)
|
||||||
|
return PLAYLIST_RESULT_NO_SUCH_SONG;
|
||||||
|
|
||||||
return PLAYLIST_RESULT_NO_SUCH_SONG;
|
return spl_append_song(utf8file, song);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum playlist_result
|
static enum playlist_result
|
||||||
|
Loading…
Reference in New Issue
Block a user