mirror of
https://github.com/SuperBFG7/ympd
synced 2025-07-07 04:12:52 +00:00
List playlists in browse filesystem view
This commit is contained in:
parent
182924815a
commit
234772155a
@ -452,6 +452,12 @@ function webSocketConnect() {
|
||||
'<td>' + minutes + ':' + (seconds < 10 ? '0' : '') + seconds +
|
||||
'</td><td></td></tr>';
|
||||
break;
|
||||
case 'playlist':
|
||||
row ='<tr uri="' + encodeURI(obj.data[item].plist) + '" class="plist">' +
|
||||
'<td><span class="material-icons">list</span></td>' +
|
||||
'<td colspan="3"><a>' + basename(obj.data[item].plist) + '</a></td>' +
|
||||
'<td></td><td></td></tr>';
|
||||
break;
|
||||
}
|
||||
if (nrItems <= tr.length) { $(tr[nrItems-1]).replaceWith(row); }
|
||||
else { $('#'+current_app+'List > tbody').append(row); }
|
||||
@ -510,6 +516,10 @@ function webSocketConnect() {
|
||||
socket.send("MPD_API_ADD_TRACK," + decodeURI($(this).attr("uri")));
|
||||
showNotification('"' + $('td:nth-last-child(3)', this).text() + '" added','','','success');
|
||||
break;
|
||||
case 'plist':
|
||||
socket.send("MPD_API_ADD_PLAYLIST," + decodeURI($(this).attr("uri")));
|
||||
showNotification('"' + $('td:nth-last-child(3)', this).text() + '" added','','','success');
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -798,6 +798,7 @@ int mpd_put_browse(char *buffer, char *path, unsigned int offset)
|
||||
char *cur = buffer;
|
||||
const char *end = buffer + MAX_SIZE;
|
||||
struct mpd_entity *entity;
|
||||
const struct mpd_playlist *pl;
|
||||
unsigned int entity_count = 0;
|
||||
unsigned int entities_returned = 0;
|
||||
|
||||
@ -840,6 +841,10 @@ int mpd_put_browse(char *buffer, char *path, unsigned int offset)
|
||||
break;
|
||||
|
||||
case MPD_ENTITY_TYPE_PLAYLIST:
|
||||
pl = mpd_entity_get_playlist(entity);
|
||||
cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"playlist\",\"plist\":");
|
||||
cur += json_emit_quoted_str(cur, end - cur, mpd_playlist_get_path(pl));
|
||||
cur += json_emit_raw_str(cur, end - cur, "},");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user