1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-06-27 23:23:15 +00:00

Queue Search Improvements -> Search as you type

This commit is contained in:
jcorporation 2018-05-25 17:12:46 +01:00
parent 78c1aae4e4
commit 2697bb9a36
3 changed files with 12 additions and 17 deletions

View File

@ -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

View File

@ -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');

View File

@ -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, "]}");