mirror of
https://github.com/SuperBFG7/ympd
synced 2024-11-05 22:36:16 +00:00
Fix: deleting track from playlist don't deletes playlist
Fix: use update_stored_playlist notify for updating playlist view
This commit is contained in:
parent
41a46b3656
commit
2d2949d6f7
@ -716,7 +716,6 @@ function dragAndDropTable(table) {
|
||||
|
||||
function playlistMoveTrack(from, to) {
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_MOVE_TRACK","data": { "plist": app.current.search, "from": from, "to": to}});
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_CONTENT_LIST","data": {"offset": app.current.page, "filter": app.current.filter, "uri": app.current.search}}, parsePlaylists);
|
||||
}
|
||||
|
||||
function webSocketConnect() {
|
||||
@ -770,6 +769,12 @@ function webSocketConnect() {
|
||||
case 'update_volume':
|
||||
parseVolume(obj);
|
||||
break;
|
||||
case 'update_stored_playlist':
|
||||
if (app.current.app == 'Browse' && app.current.tab == 'Playlists' && app.current.view == 'All')
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_LIST","data": {"offset": app.current.page, "filter": app.current.filter}}, parsePlaylists);
|
||||
else if (app.current.app == 'Browse' && app.current.tab == 'Playlists' && app.current.view == 'Detail')
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_CONTENT_LIST", "data": {"offset": app.current.page, "filter": app.current.filter, "uri": app.current.search}}, parsePlaylists);
|
||||
break;
|
||||
case 'error':
|
||||
showNotification(obj.data, '', '', 'danger');
|
||||
break;
|
||||
@ -1592,14 +1597,12 @@ function removeFromPlaylist(uri, pos) {
|
||||
pos--;
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_RM_TRACK", "data": {"uri": uri, "track": pos}});
|
||||
document.getElementById('BrowsePlaylistsDetailList').classList.add('opacity05');
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_CONTENT_LIST", "data": {"offset": app.current.page, "filter": app.current.filter, "uri": app.current.search}}, parsePlaylists);
|
||||
}
|
||||
|
||||
function playlistClear() {
|
||||
var uri = document.getElementById('BrowsePlaylistsDetailList').getAttribute('data-uri');
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_CLEAR", "data": {"uri": uri}});
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_CLEAR_AND_LIST", "data": {"uri": uri}});
|
||||
document.getElementById('BrowsePlaylistsDetailList').classList.add('opacity05');
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_CONTENT_LIST", "data": {"offset": app.current.page, "filter": app.current.filter, "uri": app.current.search}}, parsePlaylists);
|
||||
}
|
||||
|
||||
function getAllPlaylists(obj) {
|
||||
@ -1867,7 +1870,6 @@ function renamePlaylist() {
|
||||
if (to != '' && to != from && valid == '') {
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_RENAME", "data": {"from": from, "to": to}});
|
||||
modalRenamePlaylist.hide();
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_LIST","data": {"offset": app.current.page, "filter": app.current.filter}}, parsePlaylists);
|
||||
}
|
||||
else {
|
||||
document.getElementById('renamePlaylistTo').classList.add('is-invalid');
|
||||
@ -2126,7 +2128,7 @@ function showDelPlaylist(uri) {
|
||||
|
||||
function delPlaylist() {
|
||||
var uri = document.getElementById('deletePlaylist').value;
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_RM_AND_LIST", "data": {"uri": uri, "offset": app.current.page, "filter": app.current.filter}}, parsePlaylists);
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_RM", "data": {"uri": uri}});
|
||||
modalDeletePlaylist.hide();
|
||||
}
|
||||
|
||||
|
@ -546,7 +546,6 @@ void callback_mympd(struct mg_connection *nc, const struct mg_str msg) {
|
||||
n = snprintf(mpd.buf, MAX_SIZE, "{\"type\": \"result\", \"data\": \"ok\"}");
|
||||
}
|
||||
break;
|
||||
case MPD_API_PLAYLIST_RM_AND_LIST:
|
||||
case MPD_API_PLAYLIST_RM:
|
||||
je = json_scanf(msg.p, msg.len, "{data: {uri:%Q}}", &p_charbuf1);
|
||||
if (je == 1) {
|
||||
@ -560,12 +559,6 @@ void callback_mympd(struct mg_connection *nc, const struct mg_str msg) {
|
||||
free(p_charbuf1);
|
||||
n = snprintf(mpd.buf, MAX_SIZE, "{\"type\": \"result\", \"data\": \"ok\"}");
|
||||
}
|
||||
//AND_LIST
|
||||
je = json_scanf(msg.p, msg.len, "{data: {offset:%u, filter:%Q}}", &uint_buf1, &p_charbuf1);
|
||||
if (je == 2) {
|
||||
n = mympd_put_playlists(mpd.buf, uint_buf1, p_charbuf1);
|
||||
free(p_charbuf1);
|
||||
}
|
||||
break;
|
||||
case MPD_API_SETTINGS_GET:
|
||||
n = mympd_put_settings(mpd.buf);
|
||||
|
@ -65,13 +65,12 @@
|
||||
X(MPD_API_QUEUE_ADD_PLAYLIST) \
|
||||
X(MPD_API_QUEUE_REPLACE_PLAYLIST) \
|
||||
X(MPD_API_QUEUE_SHUFFLE) \
|
||||
X(MPD_API_PLAYLIST_RM_AND_LIST) \
|
||||
X(MPD_API_PLAYLIST_RM) \
|
||||
X(MPD_API_PLAYLIST_CLEAR) \
|
||||
X(MPD_API_PLAYLIST_RENAME) \
|
||||
X(MPD_API_PLAYLIST_MOVE_TRACK) \
|
||||
X(MPD_API_PLAYLIST_ADD_TRACK) \
|
||||
X(MPD_API_PLAYLIST_RM_TRACK) \
|
||||
X(MPD_API_PLAYLIST_RM) \
|
||||
X(MPD_API_PLAYLIST_LIST) \
|
||||
X(MPD_API_PLAYLIST_CONTENT_LIST) \
|
||||
X(MPD_API_SMARTPLS_UPDATE_ALL) \
|
||||
|
Loading…
Reference in New Issue
Block a user