1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-16 02:34:49 +00:00

Fix: filter empty tag values in browse database

This commit is contained in:
jcorporation 2018-09-17 16:54:59 +01:00
parent 0b354a2690
commit 45f1dc1e20
2 changed files with 4 additions and 6 deletions

View File

@ -1234,8 +1234,6 @@ function parseListDBtags(obj) {
document.getElementById('btnBrowseDatabaseTag').innerHTML = '« ' + app.current.view; document.getElementById('btnBrowseDatabaseTag').innerHTML = '« ' + app.current.view;
document.getElementById('BrowseDatabaseAlbumListCaption').innerText = obj.searchtagtype + ': ' + obj.searchstr; document.getElementById('BrowseDatabaseAlbumListCaption').innerText = obj.searchtagtype + ': ' + obj.searchstr;
var nrItems = obj.data.length; var nrItems = obj.data.length;
if (nrItems == 1 && obj.data[0].value == '')
nrItems = 0;
var cardContainer = document.getElementById('BrowseDatabaseAlbumList'); var cardContainer = document.getElementById('BrowseDatabaseAlbumList');
var cards = cardContainer.getElementsByClassName('col-md'); var cards = cardContainer.getElementsByClassName('col-md');
for (var i = 0; i < nrItems; i++) { for (var i = 0; i < nrItems; i++) {
@ -1277,12 +1275,9 @@ function parseListDBtags(obj) {
document.getElementById('BrowseDatabaseAddAllSongs').parentNode.parentNode.classList.add('hide'); document.getElementById('BrowseDatabaseAddAllSongs').parentNode.parentNode.classList.add('hide');
document.getElementById('btnBrowseDatabaseTag').parentNode.classList.add('hide'); document.getElementById('btnBrowseDatabaseTag').parentNode.classList.add('hide');
if (obj.data[0] && obj.data[0].value == '')
obj.data.shift();
var nrItems = obj.data.length; var nrItems = obj.data.length;
var tbody = document.getElementById(app.current.app + app.current.tab + 'TagList').getElementsByTagName('tbody')[0]; var tbody = document.getElementById(app.current.app + app.current.tab + 'TagList').getElementsByTagName('tbody')[0];
var tr = tbody.getElementsByTagName('tr'); var tr = tbody.getElementsByTagName('tr');
var skipped = 0;
for (var i = 0; i < nrItems; i++) { for (var i = 0; i < nrItems; i++) {
var uri = encodeURI(obj.data[i].value); var uri = encodeURI(obj.data[i].value);
if (tr[i]) if (tr[i])

View File

@ -1389,7 +1389,10 @@ int mympd_put_db_tag(char *buffer, unsigned int offset, char *mpdtagtype, char *
while((pair = mpd_recv_pair_tag(mpd.conn, mpd_tag_name_parse(mpdtagtype))) != NULL) { while((pair = mpd_recv_pair_tag(mpd.conn, mpd_tag_name_parse(mpdtagtype))) != NULL) {
entity_count ++; entity_count ++;
if (entity_count > offset && entity_count <= offset + MAX_ELEMENTS_PER_PAGE) { if (entity_count > offset && entity_count <= offset + MAX_ELEMENTS_PER_PAGE) {
if (strncmp(filter, "-", 1) == 0 || strncasecmp(filter, pair->value, 1) == 0 || if (strcmp(pair->value, "") == 0) {
entity_count --;
}
else if (strncmp(filter, "-", 1) == 0 || strncasecmp(filter, pair->value, 1) == 0 ||
(strncmp(filter, "0", 1) == 0 && isalpha(*pair->value) == 0 ) (strncmp(filter, "0", 1) == 0 && isalpha(*pair->value) == 0 )
) { ) {
if (entities_returned ++) if (entities_returned ++)