mirror of
https://github.com/SuperBFG7/ympd
synced 2024-11-05 22:36:16 +00:00
Feat: support search actions for advanced search
Fix: add all to queue button in search card
This commit is contained in:
parent
9c0d84d2ad
commit
b7c7b53a27
@ -373,7 +373,7 @@
|
||||
</div>
|
||||
<div class="input-group mr-2 hide">
|
||||
<div class="input-group-prepend">
|
||||
<button data-href='{"cmd": "addAllFromBrowseDatabase", "options": []}' id="BrowseDatabaseAddAllSongs" class="btn btn-secondary">Add all</button>
|
||||
<button data-href='{"cmd": "addAllFromBrowseDatabase", "options": []}' id="BrowseDatabaseAddAllSongs" class="btn btn-secondary material-icons">library_add</button>
|
||||
<button id="BrowseDatabaseAddAllSongsBtn" class="btn btn-secondary dropdown-toggle dropdown-toggle-split rounded-right" type="button" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu bg-dark dropdown-menu-right px-2" id="BrowseDatabaseAddAllSongsDropdown">
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block">Add all to queue</button>
|
||||
@ -445,7 +445,7 @@
|
||||
</div>
|
||||
<div class="input-group mr-2">
|
||||
<div class="input-group-prepend">
|
||||
<button data-href='{"cmd": "addAllFromBrowseFilesystem", "options": []}' id="BrowseFilesystemAddAllSongs" class="btn btn-secondary">Add all</button>
|
||||
<button data-href='{"cmd": "addAllFromBrowseFilesystem", "options": []}' id="BrowseFilesystemAddAllSongs" class="btn btn-secondary material-icons">library_add</button>
|
||||
<button id="BrowseFilesystemAddAllSongsBtn" class="btn btn-secondary dropdown-toggle dropdown-toggle-split rounded-right" type="button" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu bg-dark dropdown-menu-right px-2" id="BrowseFilesystemAddAllSongsDropdown">
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block">Add all to queue</button>
|
||||
@ -541,7 +541,7 @@
|
||||
</form>
|
||||
<div class="input-group mr-2">
|
||||
<div class="input-group-prepend">
|
||||
<button id="searchAddAllSongs" class="btn btn-secondary" data-href='{"cmd": "addAllFromSearch", "options": []}'>Add all</button>
|
||||
<button id="searchAddAllSongs" class="btn btn-secondary material-icons" data-href='{"cmd": "addAllFromSearchPlist", "options": ["queue"]}'>library_add</button>
|
||||
<button id="searchAddAllSongsBtn" class="btn btn-secondary dropdown-toggle dropdown-toggle-split rounded-right" type="button" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu bg-dark dropdown-menu-right px-2" id="searchAddAllSongsDropdown">
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block">Add all to queue</button>
|
||||
|
@ -2354,6 +2354,14 @@ function parseSmartPlaylist(obj) {
|
||||
document.getElementById('saveSmartPlaylistSearch').classList.remove('hide');
|
||||
document.getElementById('selectSaveSmartPlaylistTag').value = obj.data.tag;
|
||||
document.getElementById('inputSaveSmartPlaylistSearchstr').value = obj.data.searchstr;
|
||||
if (settings.featAdvsearch) {
|
||||
document.getElementById('selectSaveSmartPlaylistTag').parentNode.classList.add('hide');
|
||||
document.getElementById('inputSaveSmartPlaylistSearchstr').parentNode.classList.replace('col-md-6','col-md-12');
|
||||
}
|
||||
else {
|
||||
document.getElementById('selectSaveSmartPlaylistTag').parentNode.classList.remove('hide');
|
||||
document.getElementById('inputSaveSmartPlaylistSearchstr').parentNode.classList.replace('col-md-12','col-md-6');
|
||||
}
|
||||
}
|
||||
else if (obj.data.type == 'sticker') {
|
||||
document.getElementById('saveSmartPlaylistSticker').classList.remove('hide');
|
||||
@ -2390,6 +2398,8 @@ function saveSmartPlaylist() {
|
||||
if (type == 'search') {
|
||||
var tagEl = document.getElementById('selectSaveSmartPlaylistTag');
|
||||
var tag = tagEl.options[tagEl.selectedIndex].value;
|
||||
if (settings.featAdvsearch)
|
||||
tag = 'expression';
|
||||
var searchstr = document.getElementById('inputSaveSmartPlaylistSearchstr').value;
|
||||
sendAPI({"cmd": "MPD_API_SMARTPLS_SAVE", "data": {"type": type, "playlist": name, "tag": tag, "searchstr": searchstr}});
|
||||
} else if (type == 'sticker') {
|
||||
@ -2606,9 +2616,8 @@ function showMenu(el, event) {
|
||||
addMenuItem({"cmd": "replaceQueue", "options": [type, uri, name]},'Replace queue') +
|
||||
(type == 'smartpls' ? addMenuItem({"cmd": "playlistDetails", "options": [uri]}, 'View playlist') : addMenuItem({"cmd": "playlistDetails", "options": [uri]}, 'Edit playlist'))+
|
||||
(type == 'smartpls' ? addMenuItem({"cmd": "showSmartPlaylist", "options": [uri]}, 'Edit smart playlist') : '') +
|
||||
(type != 'smartpls' ?
|
||||
addMenuItem({"cmd": "showRenamePlaylist", "options": [uri]}, 'Rename playlist') +
|
||||
addMenuItem({"cmd": "showDelPlaylist", "options": [uri]}, 'Delete playlist') : '');
|
||||
addMenuItem({"cmd": "showRenamePlaylist", "options": [uri]}, 'Rename playlist') +
|
||||
addMenuItem({"cmd": "showDelPlaylist", "options": [uri]}, 'Delete playlist');
|
||||
}
|
||||
else if (app.current.app == 'Browse' && app.current.tab == 'Playlists' && app.current.view == 'Detail') {
|
||||
var x = document.getElementById('BrowsePlaylistsDetailList');
|
||||
@ -2858,9 +2867,13 @@ function addAllFromBrowseFilesystem() {
|
||||
}
|
||||
|
||||
function addAllFromSearchPlist(plist) {
|
||||
if (app.current.search.length >= 2) {
|
||||
sendAPI({"cmd": "MPD_API_DATABASE_SEARCH", "data": {"plist": plist, "filter": app.current.filter, "searchstr": app.current.search, "offset": 0}});
|
||||
showNotification('Added '+ parseInt(document.getElementById('panel-heading-search').innerText) +' songs from search to ' + plist, '', '', 'success');
|
||||
var nr = parseInt(document.getElementById('panel-heading-search').innerText);
|
||||
if (nr != NaN && nr > 0) {
|
||||
if (settings.featAdvsearch)
|
||||
sendAPI({"cmd": "MPD_API_DATABASE_SEARCH_ADV", "data": {"plist": plist, "sort": "", "sortdesc": false, "expression": app.current.search, "offset": 0}});
|
||||
else
|
||||
sendAPI({"cmd": "MPD_API_DATABASE_SEARCH", "data": {"plist": plist, "filter": app.current.filter, "searchstr": app.current.search, "offset": 0}});
|
||||
showNotification('Added ' + nr +' songs from search to ' + plist, '', '', 'success');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2546,7 +2546,10 @@ int mympd_smartpls_clear(char *playlist) {
|
||||
|
||||
int mympd_smartpls_update_search(char *playlist, char *tag, char *searchstr) {
|
||||
mympd_smartpls_clear(playlist);
|
||||
mympd_search(mpd.buf, searchstr, tag, playlist, 0);
|
||||
if (mpd.feat_advsearch == true && strcmp(tag, "expression") == 0)
|
||||
mympd_search_adv(mpd.buf, searchstr, NULL, true, NULL, playlist, 0);
|
||||
else
|
||||
mympd_search(mpd.buf, searchstr, tag, playlist, 0);
|
||||
printf("Updated %s\n", playlist);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user