mirror of
				https://github.com/SuperBFG7/ympd
				synced 2025-10-31 13:53:00 +00:00 
			
		
		
		
	Queue Search Improvements -> Search as you type
This commit is contained in:
		| @@ -35,8 +35,7 @@ Unix Build Instructions | |||||||
| 2. create build directory ```cd /path/to/src; mkdir build; cd build``` | 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``` | 3. create makefile ```cmake ..  -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE=RELEASE``` | ||||||
| 4. build ```make``` | 4. build ```make``` | ||||||
| 5. install ```sudo make install``` or just run with ```./mympd``` | 5. install ```sudo make install``` | ||||||
| Optional: |  | ||||||
| 6. Link your mpd music directory to ```/usr/share/mympd/htdocs/library``` and put ```folder.jpg``` files in your album directories | 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 | 7. Configure your mpd with http stream output to use the local player | ||||||
|  |  | ||||||
|   | |||||||
| @@ -299,6 +299,7 @@ function webSocketConnect() { | |||||||
|                     break; |                     break; | ||||||
|                 case 'search': |                 case 'search': | ||||||
|                     $('#searchList').find("tr:gt(0)").remove(); |                     $('#searchList').find("tr:gt(0)").remove(); | ||||||
|  |                     break; | ||||||
|                 case 'browse': |                 case 'browse': | ||||||
|                     if(current_app !== 'browse' && current_app !== 'search') |                     if(current_app !== 'browse' && current_app !== 'search') | ||||||
|                         break; |                         break; | ||||||
| @@ -692,7 +693,7 @@ $('#trashmode').children("button").on('click', function(e) { | |||||||
| $('#btnnotifyWeb').on('click', function (e) { | $('#btnnotifyWeb').on('click', function (e) { | ||||||
|     if(Cookies.get('notificationWeb') === 'true') { |     if(Cookies.get('notificationWeb') === 'true') { | ||||||
|         Cookies.set('notificationWeb', false, { expires: 424242 }); |         Cookies.set('notificationWeb', false, { expires: 424242 }); | ||||||
|         $('#btnnotify').removeClass('btn-success').addClass('btn-secondary'); |         $('#btnnotifyWeb').removeClass('btn-success').addClass('btn-secondary'); | ||||||
|     } else { |     } else { | ||||||
|         Notification.requestPermission(function (permission) { |         Notification.requestPermission(function (permission) { | ||||||
|             if(!('permission' in Notification)) { |             if(!('permission' in Notification)) { | ||||||
| @@ -730,10 +731,8 @@ $('#search').submit(function () { | |||||||
|  |  | ||||||
| $('#searchqueue > input').keyup(function (event) { | $('#searchqueue > input').keyup(function (event) { | ||||||
|    var searchstr=$('#searchqueue > input').val(); |    var searchstr=$('#searchqueue > input').val(); | ||||||
|    if ( event.which == 13 ) { |    if (searchstr.length >= 3) { | ||||||
|      if (searchstr.length >= 3) { |       socket.send('MPD_API_SEARCH_QUEUE,' + searchstr); | ||||||
|        socket.send('MPD_API_SEARCH_QUEUE,' + searchstr); |  | ||||||
|      } |  | ||||||
|    } |    } | ||||||
|    if (searchstr.length == 0) { |    if (searchstr.length == 0) { | ||||||
|      socket.send('MPD_API_GET_QUEUE,0'); |      socket.send('MPD_API_GET_QUEUE,0'); | ||||||
|   | |||||||
| @@ -66,7 +66,7 @@ int callback_mpd(struct mg_connection *c) | |||||||
|     int int_buf; |     int int_buf; | ||||||
|     char *p_charbuf = NULL, *token; |     char *p_charbuf = NULL, *token; | ||||||
|  |  | ||||||
| //    fprintf(stdout,"%s\n",c->content); |     fprintf(stdout,"%s\n",c->content); | ||||||
|      |      | ||||||
|     if(cmd_id == -1) |     if(cmd_id == -1) | ||||||
|         return MG_TRUE; |         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\":[ "); |         cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"queuesearch\",\"data\":[ "); | ||||||
|  |  | ||||||
|         while((song = mpd_recv_song(mpd.conn)) != NULL) { |         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, "{\"type\":\"song\""); | ||||||
| //            cur += json_emit_raw_str(cur, end - cur, ",\"uri\":"); | //            cur += json_emit_raw_str(cur, end - cur, ",\"uri\":"); | ||||||
| //            cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song)); | //            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_quoted_str(cur, end - cur, mpd_get_title(song)); | ||||||
|             cur += json_emit_raw_str(cur, end - cur, "},"); |             cur += json_emit_raw_str(cur, end - cur, "},"); | ||||||
|             mpd_song_free(song); |             mpd_song_free(song); | ||||||
|  |           } | ||||||
|             /* Maximum results */ |         } | ||||||
|             if(i++ >= 100) |          | ||||||
|             { |         if (i > 100) { | ||||||
|                 cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"wrap\"},"); |           cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"wrap\"},"); | ||||||
|                 break; |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         /* remove last ',' */ |  | ||||||
|         cur--; |         cur--; | ||||||
|  |  | ||||||
|         cur += json_emit_raw_str(cur, end - cur, "]}"); |         cur += json_emit_raw_str(cur, end - cur, "]}"); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jcorporation
					jcorporation