aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-17 17:53:43 +0200
committerMax Kellermann <max@duempel.org>2008-10-17 17:53:43 +0200
commit7ca19736c9ab90811965207010f0071d9a4b9df4 (patch)
treeb68ad1d98cc996fad47c7ae881aa8837d4896408 /src/command.c
parentf548216ead1ea275c2991bbb72feba022f14b053 (diff)
downloadmpd-7ca19736c9ab90811965207010f0071d9a4b9df4.tar.gz
mpd-7ca19736c9ab90811965207010f0071d9a4b9df4.tar.xz
mpd-7ca19736c9ab90811965207010f0071d9a4b9df4.zip
command: expect "file:///" url for local files
When adding a local file, clients have to use the "file" URI schema described in RFC 1738 3.10. By adding this schema to "urlhandlers", a client can detect whether this feature is available.
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/command.c b/src/command.c
index b4f001c85..844ce8e9a 100644
--- a/src/command.c
+++ b/src/command.c
@@ -290,6 +290,8 @@ static void addCommand(const char *name,
static int handleUrlHandlers(struct client *client,
mpd_unused int argc, mpd_unused char *argv[])
{
+ if (client_get_uid(client) > 0)
+ client_puts(client, "handler: file://\n");
return printRemoteUrlHandlers(client);
}
@@ -448,8 +450,8 @@ static int handleAdd(struct client *client,
char *path = argv[1];
enum playlist_result result;
- if (path[0] == '/' && path[1] != 0) {
- result = playlist_append_file(path, client_get_uid(client),
+ if (strncmp(path, "file:///", 8) == 0) {
+ result = playlist_append_file(path + 7, client_get_uid(client),
NULL);
return print_playlist_result(client, result);
}
@@ -473,8 +475,9 @@ static int handleAddId(struct client *client,
int added_id;
enum playlist_result result;
- if (argv[1][0] == '/')
- result = playlist_append_file(argv[1], client_get_uid(client),
+ if (strncmp(argv[1], "file:///", 8) == 0)
+ result = playlist_append_file(argv[1] + 7,
+ client_get_uid(client),
&added_id);
else
result = addToPlaylist(argv[1], &added_id);