1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-25 18:40:26 +00:00

Configurable coverimage filename

This commit is contained in:
jcorporation 2018-05-27 15:13:42 +01:00
parent 7013d2f557
commit 14ef6648c6
5 changed files with 20 additions and 8 deletions

View File

@ -53,6 +53,7 @@ Usage: ./mympd [OPTION]...
-s, --streamport <port> connect to mpd http stream at port [8000]
-u, --user <username> drop priviliges to user after socket bind
-m, --mpdpass <password> specifies the password to use when connecting to mpd
-i, --coverimage <filename> filename for coverimage [folder.jpg]
-V, --version get version
--help this help
```

View File

@ -30,12 +30,15 @@ specifies the port for the webserver to listen to, defaults to 8080
\fB-s\fR, \fB\-\-streamport PORT
connect to mpd http stream at port [8000]
.TP
\fB\-u\fR, \fB\-\-user username\fR
\fB\-u\fR, \fB\-\-user USERNAME\fR
drop privileges to the provided username after socket binding
.TP
\fB\-m\fR, \fB\-\-mpdpass password\fR
\fB\-m\fR, \fB\-\-mpdpass PASSWORD\fR
specifies the password to use when connecting to mpd
.TP
\fB-i\fR, \fB\-\-coverimage FILENAME\fR
filename for coverimage [folder.jpg]
.TP
\fB\-V\fR, \fB\-\-version\fR
print version and exit
.TP

View File

@ -299,8 +299,9 @@ out_send_message:
break;
case MPD_API_GET_OPTIONS:
n = snprintf(mpd.buf, MAX_SIZE, "{\"type\":\"mpdoptions\", \"data\": "
"{\"mpdhost\" : \"%s\", \"mpdport\": \"%d\", \"passwort_set\": %s, \"streamport\": \"%d\"}"
"}", mpd.host, mpd.port, mpd.password ? "true" : "false", streamport);
"{\"mpdhost\" : \"%s\", \"mpdport\": \"%d\", \"passwort_set\": %s, "
"\"streamport\": \"%d\",\"coverimage\": \"%s\"}"
"}", mpd.host, mpd.port, mpd.password ? "true" : "false", streamport, coverimage);
break;
}

View File

@ -89,10 +89,10 @@ enum mpd_conn_states {
struct t_mpd {
int port;
int local_port;
int local_port;
char host[128];
char *password;
char *gpass;
char *gpass;
struct mpd_connection *conn;
enum mpd_conn_states conn_state;
@ -106,6 +106,7 @@ struct t_mpd {
} mpd;
int streamport;
char coverimage[40];
struct t_mpd_client_session {
int song_id;
@ -121,7 +122,7 @@ int mpd_put_current_song(char *buffer);
int mpd_put_queue(char *buffer, unsigned int offset);
int mpd_put_browse(char *buffer, char *path, unsigned int offset);
int mpd_search(char *buffer, char *searchstr);
int mpd_search_queue(char *buffer, char *mp3tag, char *searchstr);
int mpd_search_queue(char *buffer, char *mpdtagtype, char *searchstr);
void mpd_disconnect();
#endif

View File

@ -95,6 +95,7 @@ int main(int argc, char **argv)
mpd.gpass = NULL;
strcpy(mpd.host, "127.0.0.1");
streamport = 8000;
strcpy(coverimage, "folder.jpg");
static struct option long_options[] = {
{"digest", required_argument, 0, 'D'},
@ -107,10 +108,11 @@ int main(int argc, char **argv)
{"help", no_argument, 0, 0 },
{"mpdpass", required_argument, 0, 'm'},
{"streamport", required_argument, 0, 's'},
{"coverimage", required_argument, 0, 'i'},
{0, 0, 0, 0 }
};
while((n = getopt_long(argc, argv, "D:h:p:l:w:u:d:v:m:s",
while((n = getopt_long(argc, argv, "D:h:p:l:w:u:d:v:m:s:i:",
long_options, &option_index)) != -1) {
switch (n) {
case 'D':
@ -138,6 +140,9 @@ int main(int argc, char **argv)
case 's':
streamport = atoi(optarg);
break;
case 'i':
strncpy(coverimage, optarg, sizeof(coverimage));
break;
case 'v':
fprintf(stdout, "myMPD %d.%d.%d\n"
"Copyright (C) 2018 Juergen Mang <mail@jcgames.de>\n"
@ -157,6 +162,7 @@ int main(int argc, char **argv)
" -v, --version\t\t\tget version\n"
" -m, --mpdpass <password>\tspecifies the password to use when connecting to mpd\n"
" -s, --streamport <port>\tconnect to mpd http stream at port [8000]\n"
" -i, --coverimage <filename>\tfilename for coverimage [folder.jpg]\n"
" --help\t\t\t\tthis help\n"
, argv[0]);
return EXIT_FAILURE;