diff --git a/README.md b/README.md index b6ed40d..ecbcb2e 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,7 @@ Unix Build Instructions 2. create build directory ```cd /path/to/src; mkdir build; cd build``` 3. create makefile ```cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE=RELEASE``` 4. build ```make``` -5. install ```sudo make install``` or just run with ```./mympd``` -Optional: +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 diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 24db04c..42f6190 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -299,6 +299,7 @@ function webSocketConnect() { break; case 'search': $('#searchList').find("tr:gt(0)").remove(); + break; case 'browse': if(current_app !== 'browse' && current_app !== 'search') break; @@ -692,7 +693,7 @@ $('#trashmode').children("button").on('click', function(e) { $('#btnnotifyWeb').on('click', function (e) { if(Cookies.get('notificationWeb') === 'true') { Cookies.set('notificationWeb', false, { expires: 424242 }); - $('#btnnotify').removeClass('btn-success').addClass('btn-secondary'); + $('#btnnotifyWeb').removeClass('btn-success').addClass('btn-secondary'); } else { Notification.requestPermission(function (permission) { if(!('permission' in Notification)) { @@ -730,10 +731,8 @@ $('#search').submit(function () { $('#searchqueue > input').keyup(function (event) { var searchstr=$('#searchqueue > input').val(); - if ( event.which == 13 ) { - if (searchstr.length >= 3) { - socket.send('MPD_API_SEARCH_QUEUE,' + searchstr); - } + if (searchstr.length >= 3) { + socket.send('MPD_API_SEARCH_QUEUE,' + searchstr); } if (searchstr.length == 0) { socket.send('MPD_API_GET_QUEUE,0'); diff --git a/src/mpd_client.c b/src/mpd_client.c index dc0c8fb..8670f45 100644 --- a/src/mpd_client.c +++ b/src/mpd_client.c @@ -66,7 +66,7 @@ int callback_mpd(struct mg_connection *c) int int_buf; char *p_charbuf = NULL, *token; -// fprintf(stdout,"%s\n",c->content); + fprintf(stdout,"%s\n",c->content); if(cmd_id == -1) return MG_TRUE; @@ -809,6 +809,7 @@ int mpd_search_queue(char *buffer, char *searchstr) cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"queuesearch\",\"data\":[ "); while((song = mpd_recv_song(mpd.conn)) != NULL) { + if(i++ <= 100) { cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"song\""); // cur += json_emit_raw_str(cur, end - cur, ",\"uri\":"); // cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song)); @@ -828,16 +829,12 @@ int mpd_search_queue(char *buffer, char *searchstr) cur += json_emit_quoted_str(cur, end - cur, mpd_get_title(song)); cur += json_emit_raw_str(cur, end - cur, "},"); mpd_song_free(song); - - /* Maximum results */ - if(i++ >= 100) - { - cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"wrap\"},"); - break; - } + } + } + + if (i > 100) { + cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"wrap\"},"); } - - /* remove last ',' */ cur--; cur += json_emit_raw_str(cur, end - cur, "]}");