mirror of
				https://github.com/SuperBFG7/ympd
				synced 2025-10-31 13:53:00 +00:00 
			
		
		
		
	Queue Search
This commit is contained in:
		| @@ -46,6 +46,7 @@ var app = $.sammy(function() { | ||||
|         $('#cardBrowse').addClass('hide'); | ||||
|         $('#cardSearch').addClass('hide'); | ||||
|         $('.pagination').addClass('hide'); | ||||
|         $('#searchqueue > input').val(''); | ||||
|         pagination = 0; | ||||
|         browsepath = ''; | ||||
|     } | ||||
| @@ -223,7 +224,7 @@ function webSocketConnect() { | ||||
|                     $('#queueList > tbody').empty(); | ||||
|                     for (var song in obj.data) { | ||||
|                         if (obj.data[song].type == 'wrap') { | ||||
|                             $('#'+current_app+'List > tbody').append( | ||||
|                             $('#queueList > tbody').append( | ||||
|                                  "<tr><td><span class=\"material-icons\">error_outline</span></td>" + | ||||
|                                  "<td colspan=\"3\">Too many results, please refine your search!</td>" + | ||||
|                                  "<td></td><td></td></tr>" | ||||
| @@ -251,6 +252,8 @@ function webSocketConnect() { | ||||
|                             $('#queuePrev').removeClass('disabled'); | ||||
|                             $('#queuePagination').removeClass('hide'); | ||||
|                         } | ||||
|                     } else { | ||||
|                         $('#queuePagination').addClass('hide'); | ||||
|                     } | ||||
|  | ||||
|                     if ( isTouch ) { | ||||
| @@ -726,15 +729,15 @@ $('#search').submit(function () { | ||||
| }); | ||||
|  | ||||
| $('#searchqueue > input').keyup(function (event) { | ||||
| //   if ( event.which == 13 ) { | ||||
|    var searchstr=$('#searchqueue > input').val(); | ||||
|      if (searchstr.length > 3) { | ||||
|    if ( event.which == 13 ) { | ||||
|      if (searchstr.length >= 3) { | ||||
|        socket.send('MPD_API_SEARCH_QUEUE,' + searchstr); | ||||
|      } | ||||
|      else if (searchstr.length == 0) { | ||||
|    } | ||||
|    if (searchstr.length == 0) { | ||||
|      socket.send('MPD_API_GET_QUEUE,0'); | ||||
|    } | ||||
| //   } | ||||
| }); | ||||
|  | ||||
| $('#searchqueue').submit(function () { | ||||
|   | ||||
| @@ -760,8 +760,9 @@ int mpd_search(char *buffer, char *searchstr) | ||||
|         cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"search\",\"data\":[ "); | ||||
|  | ||||
|         while((song = mpd_recv_song(mpd.conn)) != NULL) { | ||||
|             cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"song\",\"uri\":"); | ||||
|             cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song)); | ||||
|             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)); | ||||
|             cur += json_emit_raw_str(cur, end - cur, ",\"album\":"); | ||||
|             cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song)); | ||||
|             cur += json_emit_raw_str(cur, end - cur, ",\"artist\":"); | ||||
| @@ -808,8 +809,9 @@ 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) { | ||||
|             cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"song\",\"uri\":"); | ||||
|             cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song)); | ||||
|             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)); | ||||
|             cur += json_emit_raw_str(cur, end - cur, ",\"id\":"); | ||||
|             cur += json_emit_int(cur, end - cur, mpd_song_get_id(song));             | ||||
|             cur += json_emit_raw_str(cur, end - cur, ",\"pos\":"); | ||||
| @@ -828,7 +830,7 @@ int mpd_search_queue(char *buffer, char *searchstr) | ||||
|             mpd_song_free(song); | ||||
|  | ||||
|             /* Maximum results */ | ||||
|             if(i++ >= 300) | ||||
|             if(i++ >= 100) | ||||
|             { | ||||
|                 cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"wrap\"},"); | ||||
|                 break; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 jcorporation
					jcorporation