1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-06-25 22:23:16 +00:00

Document state file option

This commit is contained in:
jcorporation 2018-06-21 18:28:07 +01:00
parent c11bfa0d1a
commit 2098060765
7 changed files with 19 additions and 8 deletions

View File

@ -52,3 +52,4 @@ target_link_libraries(mympd ${LIBMPDCLIENT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
install(TARGETS mympd DESTINATION bin)
install(FILES mympd.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
install(DIRECTORY htdocs DESTINATION share/${PROJECT_NAME})
install(DIRECTORY DESTINATION /var/lib/mympd)

View File

@ -16,7 +16,6 @@ UI Components
- Bootstrap Slider: https://github.com/seiyria/bootstrap-slider
- Material Design Icons: https://material.io/tools/icons/?style=baseline
- jQuery: https://jquery.com/
- js-cookie: https://github.com/js-cookie/js-cookie
Backend
-------
@ -36,8 +35,9 @@ Unix Build Instructions
3. create makefile ```cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE=RELEASE```
4. build ```make```
5. install ```sudo make install```
6. Link your mpd music directory to ```/usr/share/mympd/htdocs/library``` and put ```folder.jpg``` files in your album directories
7. Configure your mpd with http stream output to use the local player
6. change owner of /var/lib/mympd to user you will run mympd, default nobody (chown nobody /var/lib/mympd)
7. Link your mpd music directory to ```/usr/share/mympd/htdocs/library``` and put ```folder.jpg``` files in your album directories
8. Configure your mpd with http stream output to use the local player
Run flags
---------
@ -51,6 +51,7 @@ Usage: ./mympd [OPTION]...
-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]
-t, --statefile <filename> filename for mympd state [/var/lib/mympd/mympd.state]
-v, --version get version
--help this help
```

View File

@ -5,3 +5,4 @@ MPD_PASSWORD=
WEB_PORT=80
MYMPD_USER=nobody
COVERIMAGE=--coverimage folder.jpg
STATEFILE=--statefile /var/lib/mympd/mympd.state

View File

@ -9,8 +9,9 @@ Environment=MPD_PASSWORD=
Environment=WEB_PORT=80
Environment=MYMPD_USER=nobody
Environment=COVERIMAGE=--coverimage folder.jpg
Envirinment=STATEFILE=--statefile /var/lib/mympd/mympd.state
EnvironmentFile=/etc/default/mympd
ExecStart=/usr/bin/mympd --user $MYMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT $COVERIMAGE
ExecStart=/usr/bin/mympd --user $MYMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT $COVERIMAGE $STATEFILE
Type=simple
[Install]

View File

@ -31,7 +31,6 @@ var isTouch = Modernizr.touch ? 1 : 0;
var playstate = '';
var progressBar;
var volumeBar;
var coverImageFile = '';
var settings = {};
var app = {};
@ -213,7 +212,7 @@ app.route=function() {
};
$(document).ready(function(){
sendAPI({"cmd":"MPD_API_GET_SETTINGS"},parseSettings);
getSettings();
sendAPI({"cmd":"MPD_API_GET_OUTPUTNAMES"},parseOutputnames);
webSocketConnect();
@ -432,6 +431,10 @@ function parseSettings(obj) {
setLocalStream(obj.data.mpdhost,obj.data.streamport);
}
function getSettings() {
sendAPI({"cmd":"MPD_API_GET_SETTINGS"},parseSettings);
}
function parseOutputnames(obj) {
$('#btn-outputs-block button').remove();
if ( Object.keys(obj.data).length ) {
@ -1125,7 +1128,7 @@ function confirmSettings() {
"mixrampdelay": $('#inputMixrampdelay').val(),
"notificationWeb": ($('#btnnotifyWeb').hasClass('btn-success') ? 1 : 0),
"notificationPage": ($('#btnnotifyPage').hasClass('btn-success') ? 1 : 0)
}});
}},getSettings);
$('#settings').modal('hide');
}
}

View File

@ -33,6 +33,9 @@ specifies the password to use when connecting to mpd
\fB-i\fR, \fB\-\-coverimage FILENAME\fR
filename for coverimage [folder.jpg]
.TP
\fB-t\fR, \fB\-\-statefile FILENAME\fR
filename for mympd state [/var/lib/mympd/mympd.state]
.TP
\fB\-v\fR, \fB\-\-version\fR
print version and exit
.TP

View File

@ -113,7 +113,8 @@ void callback_mympd(struct mg_connection *nc, const struct mg_str msg)
mpd_return_pair(mpd.conn, pair);
}
}
free(p_charbuf1);
free(p_charbuf1);
n = snprintf(mpd.buf, MAX_SIZE, "{\"type\":\"result\", \"data\": \"ok\"}");
break;
case MPD_API_GET_ARTISTALBUMTITLES:
je = json_scanf(msg.p, msg.len, "{ data: { albumartist:%Q, album:%Q } }", &p_charbuf1, &p_charbuf2);