aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-15 22:35:13 +0200
committerMax Kellermann <max@duempel.org>2008-10-15 22:35:13 +0200
commit8c0060fae44a94bdfe978d8d4a66589f5a03a074 (patch)
treefde581584c25e5e74d8a8336f54dc61d4a5f67db /src/command.c
parent0b44cad2ce2c6433f395650a5a70cf8b3473673c (diff)
downloadmpd-8c0060fae44a94bdfe978d8d4a66589f5a03a074.tar.gz
mpd-8c0060fae44a94bdfe978d8d4a66589f5a03a074.tar.xz
mpd-8c0060fae44a94bdfe978d8d4a66589f5a03a074.zip
playlist: added support for adding songs not in the music database
Clients which have authenticated via unix socket may add local files to the MPD playlist, provided that they own the file.
Diffstat (limited to '')
-rw-r--r--src/command.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/command.c b/src/command.c
index 3174faf70..b141bda45 100644
--- a/src/command.c
+++ b/src/command.c
@@ -229,6 +229,10 @@ static int print_playlist_result(struct client *client,
command_error(client, ACK_ERROR_SYSTEM, strerror(errno));
return -1;
+ case PLAYLIST_RESULT_DENIED:
+ command_error(client, ACK_ERROR_NO_EXIST, "Access denied");
+ return -1;
+
case PLAYLIST_RESULT_NO_SUCH_SONG:
command_error(client, ACK_ERROR_NO_EXIST, "No such song");
return -1;
@@ -444,6 +448,12 @@ static int handleAdd(struct client *client,
char *path = argv[1];
enum playlist_result result;
+ if (path[0] == '/') {
+ result = playlist_append_file(path, client_get_uid(client),
+ NULL);
+ return print_playlist_result(client, result);
+ }
+
if (isRemoteUrl(path))
return addToPlaylist(path, NULL);
@@ -461,7 +471,13 @@ static int handleAddId(struct client *client,
int argc, char *argv[])
{
int added_id;
- enum playlist_result result = addToPlaylist(argv[1], &added_id);
+ enum playlist_result result;
+
+ if (argv[1][0] == '/')
+ result = playlist_append_file(argv[1], client_get_uid(client),
+ &added_id);
+ else
+ result = addToPlaylist(argv[1], &added_id);
if (result != PLAYLIST_RESULT_SUCCESS)
return print_playlist_result(client, result);