mirror of
https://github.com/SuperBFG7/ympd
synced 2025-01-15 03:35:48 +00:00
List playlists in browse filesystem view
This commit is contained in:
parent
182924815a
commit
234772155a
@ -436,7 +436,7 @@ function webSocketConnect() {
|
|||||||
var row='';
|
var row='';
|
||||||
switch(obj.data[item].type) {
|
switch(obj.data[item].type) {
|
||||||
case 'directory':
|
case 'directory':
|
||||||
row='<tr uri="' + encodeURI(obj.data[item].dir) + '" class="dir">' +
|
row ='<tr uri="' + encodeURI(obj.data[item].dir) + '" class="dir">' +
|
||||||
'<td><span class="material-icons">folder_open</span></td>' +
|
'<td><span class="material-icons">folder_open</span></td>' +
|
||||||
'<td colspan="3"><a>' + basename(obj.data[item].dir) + '</a></td>' +
|
'<td colspan="3"><a>' + basename(obj.data[item].dir) + '</a></td>' +
|
||||||
'<td></td><td></td></tr>';
|
'<td></td><td></td></tr>';
|
||||||
@ -444,7 +444,7 @@ function webSocketConnect() {
|
|||||||
case 'song':
|
case 'song':
|
||||||
var minutes = Math.floor(obj.data[item].duration / 60);
|
var minutes = Math.floor(obj.data[item].duration / 60);
|
||||||
var seconds = obj.data[item].duration - minutes * 60;
|
var seconds = obj.data[item].duration - minutes * 60;
|
||||||
row='<tr uri="' + encodeURI(obj.data[item].uri) + '" class="song">' +
|
row ='<tr uri="' + encodeURI(obj.data[item].uri) + '" class="song">' +
|
||||||
'<td><span class="material-icons">music_note</span></td>' +
|
'<td><span class="material-icons">music_note</span></td>' +
|
||||||
'<td>' + obj.data[item].title + '</td>' +
|
'<td>' + obj.data[item].title + '</td>' +
|
||||||
'<td>' + obj.data[item].artist + '</td>' +
|
'<td>' + obj.data[item].artist + '</td>' +
|
||||||
@ -452,6 +452,12 @@ function webSocketConnect() {
|
|||||||
'<td>' + minutes + ':' + (seconds < 10 ? '0' : '') + seconds +
|
'<td>' + minutes + ':' + (seconds < 10 ? '0' : '') + seconds +
|
||||||
'</td><td></td></tr>';
|
'</td><td></td></tr>';
|
||||||
break;
|
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); }
|
if (nrItems <= tr.length) { $(tr[nrItems-1]).replaceWith(row); }
|
||||||
else { $('#'+current_app+'List > tbody').append(row); }
|
else { $('#'+current_app+'List > tbody').append(row); }
|
||||||
@ -510,6 +516,10 @@ function webSocketConnect() {
|
|||||||
socket.send("MPD_API_ADD_TRACK," + decodeURI($(this).attr("uri")));
|
socket.send("MPD_API_ADD_TRACK," + decodeURI($(this).attr("uri")));
|
||||||
showNotification('"' + $('td:nth-last-child(3)', this).text() + '" added','','','success');
|
showNotification('"' + $('td:nth-last-child(3)', this).text() + '" added','','','success');
|
||||||
break;
|
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;
|
char *cur = buffer;
|
||||||
const char *end = buffer + MAX_SIZE;
|
const char *end = buffer + MAX_SIZE;
|
||||||
struct mpd_entity *entity;
|
struct mpd_entity *entity;
|
||||||
|
const struct mpd_playlist *pl;
|
||||||
unsigned int entity_count = 0;
|
unsigned int entity_count = 0;
|
||||||
unsigned int entities_returned = 0;
|
unsigned int entities_returned = 0;
|
||||||
|
|
||||||
@ -840,6 +841,10 @@ int mpd_put_browse(char *buffer, char *path, unsigned int offset)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MPD_ENTITY_TYPE_PLAYLIST:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user