mirror of
https://github.com/SuperBFG7/ympd
synced 2025-11-28 11:05:14 +00:00
Merge branch 'master' of https://github.com/lesderid/ympd into lesderid-master
This commit is contained in:
@@ -64,7 +64,8 @@ int callback_mpd(struct mg_connection *c)
|
||||
return MG_TRUE;
|
||||
|
||||
if(mpd.conn_state != MPD_CONNECTED && cmd_id != MPD_API_SET_MPDHOST &&
|
||||
cmd_id != MPD_API_GET_MPDHOST && cmd_id != MPD_API_SET_MPDPASS)
|
||||
cmd_id != MPD_API_GET_MPDHOST && cmd_id != MPD_API_SET_MPDPASS &&
|
||||
cmd_id != MPD_API_GET_DIRBLEAPITOKEN)
|
||||
return MG_TRUE;
|
||||
|
||||
switch(cmd_id)
|
||||
@@ -290,6 +291,10 @@ out_host_change:
|
||||
"{\"host\" : \"%s\", \"port\": \"%d\", \"passwort_set\": %s}"
|
||||
"}", mpd.host, mpd.port, mpd.password ? "true" : "false");
|
||||
break;
|
||||
case MPD_API_GET_DIRBLEAPITOKEN:
|
||||
n = snprintf(mpd.buf, MAX_SIZE, "{\"type\":\"dirbleapitoken\", \""
|
||||
"data\": \"%s\"}", dirble_api_token);
|
||||
break;
|
||||
case MPD_API_SET_MPDPASS:
|
||||
p_charbuf = strdup(c->content);
|
||||
if(strcmp(strtok(p_charbuf, ","), "MPD_API_SET_MPDPASS"))
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
X(MPD_API_GET_QUEUE) \
|
||||
X(MPD_API_GET_BROWSE) \
|
||||
X(MPD_API_GET_MPDHOST) \
|
||||
X(MPD_API_GET_DIRBLEAPITOKEN) \
|
||||
X(MPD_API_ADD_TRACK) \
|
||||
X(MPD_API_ADD_PLAY_TRACK) \
|
||||
X(MPD_API_ADD_PLAYLIST) \
|
||||
@@ -97,6 +98,8 @@ struct t_mpd {
|
||||
unsigned queue_version;
|
||||
} mpd;
|
||||
|
||||
char dirble_api_token[28];
|
||||
|
||||
struct t_mpd_client_session {
|
||||
int song_id;
|
||||
unsigned queue_version;
|
||||
|
||||
@@ -80,10 +80,13 @@ int main(int argc, char **argv)
|
||||
mpd.port = 6600;
|
||||
strcpy(mpd.host, "127.0.0.1");
|
||||
|
||||
strcpy(dirble_api_token, "2e223c9909593b94fc6577361a");
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"host", required_argument, 0, 'h'},
|
||||
{"port", required_argument, 0, 'p'},
|
||||
{"webport", required_argument, 0, 'w'},
|
||||
{"dirbletoken", required_argument, 0, 'd'},
|
||||
{"user", required_argument, 0, 'u'},
|
||||
{"version", no_argument, 0, 'v'},
|
||||
{"help", no_argument, 0, 0 },
|
||||
@@ -103,6 +106,9 @@ int main(int argc, char **argv)
|
||||
case 'w':
|
||||
webport = strdup(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
strncpy(dirble_api_token, optarg, sizeof(dirble_api_token));
|
||||
break;
|
||||
case 'u':
|
||||
run_as_user = strdup(optarg);
|
||||
break;
|
||||
@@ -122,6 +128,7 @@ int main(int argc, char **argv)
|
||||
" -p, --port <port>\t\tconnect to mpd at port [6600]\n"
|
||||
" -w, --webport [ip:]<port>\tlisten interface/port for webserver [8080]\n"
|
||||
" -u, --user <username>\t\tdrop priviliges to user after socket bind\n"
|
||||
" -d, --dirbletoken <apitoken>\tDirble API token\n"
|
||||
" -V, --version\t\t\tget version\n"
|
||||
" -m, --mpdpass <password>\tspecifies the password to use when connecting to mpd\n"
|
||||
" --help\t\t\t\tthis help\n"
|
||||
|
||||
Reference in New Issue
Block a user