mirror of
https://github.com/SuperBFG7/ympd
synced 2026-10-07 00:01:41 +00:00
This commit is contained in:
+16
-14
@@ -28,7 +28,7 @@
|
||||
<div class="collapse" id="menu-dbupdate">
|
||||
<a class="dropdown-item text-light bg-dark" href="#" data-href='{"cmd": "updateDB", "options": []}'>Update Database</a>
|
||||
<a class="dropdown-item text-light bg-dark" href="#" data-href='{"cmd": "rescanDB", "options": []}'>Rescan Database</a>
|
||||
<a class="dropdown-item text-light bg-dark" href="#" data-href='{"cmd": "updateSmartPlaylists", "options": []}'>Update Smart Playlists</a>
|
||||
<a class="dropdown-item text-light bg-dark featSmartpls" href="#" data-href='{"cmd": "updateSmartPlaylists", "options": []}'>Update Smart Playlists</a>
|
||||
</div>
|
||||
<a class="dropdown-item text-light bg-dark" href="#" data-href='{"cmd": "openLocalPlayer", "options": []}'>Local Player</a>
|
||||
<a class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#modalSettings">Settings</a>
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
<div class="card" id="cardPlayback">
|
||||
<div class="card-header">Playback
|
||||
<div class="btn-group btn-group-sm stickers pull-right">
|
||||
<div class="btn-group btn-group-sm featStickers pull-right">
|
||||
<button title="Dislike song" id="btnVoteDown" data-href='{"cmd": "voteSong", "options": [0]}' class="btn btn-sm btn-light material-icons">thumb_down</button>
|
||||
<button title="Like song" id="btnVoteUp" data-href='{"cmd": "voteSong", "options": [2]}' class="btn btn-sm btn-light material-icons">thumb_up</button>
|
||||
</div>
|
||||
@@ -90,10 +90,12 @@
|
||||
<div class="album-cover" id="currentCover"></div>
|
||||
<div class="album-desc">
|
||||
<h2 id="currentTrack" data-href='{"cmd": "songClick", "options": []}'></h2>
|
||||
<small>Artist</small>
|
||||
<h4 id="currentArtist" data-href='{"cmd": "artistClick", "options": []}'></h4>
|
||||
<small>Album</small>
|
||||
<h4 id="currentAlbum" data-href='{"cmd": "albumClick", "options": []}'></h4>
|
||||
<div class="featTags">
|
||||
<small>Artist</small>
|
||||
<h4 id="currentArtist" data-href='{"cmd": "artistClick", "options": []}'></h4>
|
||||
<small>Album</small>
|
||||
<h4 id="currentAlbum" data-href='{"cmd": "albumClick", "options": []}'></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer card-footer-playback">
|
||||
@@ -111,7 +113,7 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="btn-toolbar card-toolbar" id="queue-buttons">
|
||||
<div class="btn-group mr-2">
|
||||
<div class="btn-group mr-2 featPlaylists">
|
||||
<button type="button" class="btn btn-secondary material-icons" data-toggle="modal" data-target="#modalSaveQueue" title="Save queue">
|
||||
save
|
||||
</button>
|
||||
@@ -199,10 +201,10 @@
|
||||
<div class="card hide" id="cardBrowse">
|
||||
<div class="card-header" id="panel-heading-browse">
|
||||
<ul class="nav nav-tabs card-header-tabs">
|
||||
<li class="nav-item">
|
||||
<li class="nav-item featTags">
|
||||
<a data-href='{"cmd": "appGoto", "options": ["Browse", "Database"]}' class="nav-link text-dark" href="#" id="cardBrowseNavDatabase">Database</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item featPlaylists">
|
||||
<a data-href='{"cmd": "appGoto", "options": ["Browse", "Playlists"]}' class="nav-link text-dark" href="#" id="cardBrowseNavPlaylists">Playlists</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
@@ -310,7 +312,7 @@
|
||||
<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>
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block">Add all to playlist</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block featPlaylists">Add all to playlist</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -375,7 +377,7 @@
|
||||
<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>
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block">Add all to playlist</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block featPlaylists">Add all to playlist</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -460,8 +462,8 @@
|
||||
<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>
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block">Add all to playlist</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block smartpls">Save as smart playlist</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block featPlaylists">Add all to playlist</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block featSmartpls">Save as smart playlist</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -580,7 +582,7 @@
|
||||
<div class="invalid-feedback">Invalid uri</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row featPlaylists">
|
||||
<div class="form-group col-md-12">
|
||||
<button id="toggleAddToPlaylistBtn" class="btn btn-secondary" data-href='{"cmd": "toggleAddToPlaylistFrm", "options":[]}'>Add to playlist</button>
|
||||
</div>
|
||||
|
||||
+86
-37
@@ -943,6 +943,24 @@ function toggleBtn(btn, state) {
|
||||
b.classList.remove('active');
|
||||
}
|
||||
|
||||
function filterCols(x) {
|
||||
var tags = settings.tags.slice();
|
||||
if (settings.featTags == false)
|
||||
tags.push('Title');
|
||||
tags.push('Duration');
|
||||
if (x == 'colsQueue' || x == 'colsBrowsePlaylistsDetail')
|
||||
tags.push('Pos');
|
||||
if (x == 'colsBrowseFilesystem')
|
||||
tags.push('Type');
|
||||
|
||||
var cols = [];
|
||||
for (var i = 0; i < settings[x].length; i++) {
|
||||
if (tags.includes(settings[x][i]))
|
||||
cols.push(settings[x][i]);
|
||||
}
|
||||
settings[x] = cols;
|
||||
}
|
||||
|
||||
function parseSettings(obj) {
|
||||
toggleBtn('btnRandom', obj.data.random);
|
||||
toggleBtn('btnConsume', obj.data.consume);
|
||||
@@ -995,18 +1013,21 @@ function parseSettings(obj) {
|
||||
|
||||
toggleBtn('btnnotifyPage', obj.data.notificationPage);
|
||||
|
||||
var stickerEls = document.getElementsByClassName('stickers');
|
||||
var stickerElsLen = stickerEls.length;
|
||||
var displayStickers = obj.data.stickers == true ? '' : 'none';
|
||||
for (var i = 0; i < stickerElsLen; i++)
|
||||
stickerEls[i].style.display = displayStickers;
|
||||
|
||||
var smartplsEls = document.getElementsByClassName('smartpls');
|
||||
var smartplsElsLen = smartplsEls.length;
|
||||
var displaySmartpls = obj.data.smartpls == true ? '' : 'none';
|
||||
for (var i = 0; i < smartplsElsLen; i++)
|
||||
smartplsEls[i].style.display = displaySmartpls;
|
||||
var features = ["featStickers", "featSmartpls", "featPlaylists", "featTags"];
|
||||
|
||||
for (var j = 0; j < features.length; j++) {
|
||||
var Els = document.getElementsByClassName(features[j]);
|
||||
var ElsLen = Els.length;
|
||||
var displayEl = obj.data[features[j]] == true ? '' : 'none';
|
||||
for (var i = 0; i < ElsLen; i++)
|
||||
Els[i].style.display = displayEl;
|
||||
}
|
||||
|
||||
if (obj.data.featTags == false) {
|
||||
app.apps.Browse.active = 'Filesystem';
|
||||
app.apps.Search.state = '0/filename/';
|
||||
}
|
||||
|
||||
if (obj.data.mixramp == true)
|
||||
document.getElementsByClassName('mixramp')[0].style.display = '';
|
||||
else
|
||||
@@ -1025,8 +1046,17 @@ function parseSettings(obj) {
|
||||
|
||||
settings = obj.data;
|
||||
|
||||
playlistEl = 'selectJukeboxPlaylist';
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_LIST", "data": {"offset": 0, "filter": "-"}}, getAllPlaylists);
|
||||
if (obj.data.featPlaylists) {
|
||||
playlistEl = 'selectJukeboxPlaylist';
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_LIST", "data": {"offset": 0, "filter": "-"}}, getAllPlaylists);
|
||||
} else {
|
||||
document.getElementById('selectJukeboxPlaylist').innerHTML = '<option>Database</option>';
|
||||
}
|
||||
|
||||
filterCols('colsSearch');
|
||||
filterCols('colsQueue');
|
||||
filterCols('colsBrowsePlaylistsDetail');
|
||||
filterCols('colsBrowseFilesystem');
|
||||
|
||||
settings.mpdstream = 'http://';
|
||||
if (settings.mpdhost == '127.0.0.1' || settings.mpdhost == 'localhost')
|
||||
@@ -1069,9 +1099,13 @@ function parseSettings(obj) {
|
||||
function setCols(table) {
|
||||
var tagChks = '';
|
||||
var tags = settings.tags.slice();
|
||||
if (settings.featTags == false)
|
||||
tags.push('Title');
|
||||
tags.push('Duration');
|
||||
if (table == 'Queue' || table == 'BrowsePlaylistsDetail')
|
||||
tags.push('Pos');
|
||||
if (table == 'BrowseFilesystem')
|
||||
tags.push('Type');
|
||||
|
||||
for (var i = 0; i < tags.length; i++) {
|
||||
tagChks += '<div class="form-check">' +
|
||||
@@ -1086,11 +1120,13 @@ function setCols(table) {
|
||||
|
||||
var heading = '';
|
||||
for (var i = 0; i < settings['cols' + table].length; i++) {
|
||||
var h = settings['cols' + table][i];
|
||||
heading += '<th draggable="true" data-col="' + h + '">';
|
||||
if (h == 'Track' || h == 'Pos')
|
||||
h = '#';
|
||||
heading += h + '</th>';
|
||||
// if (tags.includes(settings['cols' + table][i])) {
|
||||
var h = settings['cols' + table][i];
|
||||
heading += '<th draggable="true" data-col="' + h + '">';
|
||||
if (h == 'Track' || h == 'Pos')
|
||||
h = '#';
|
||||
heading += h + '</th>';
|
||||
// }
|
||||
}
|
||||
heading += '<th></th>';
|
||||
document.getElementById(table + 'List').getElementsByTagName('tr')[0].innerHTML = heading;
|
||||
@@ -1183,7 +1219,6 @@ function setCounter(currentSongId, totalTime, elapsedTime) {
|
||||
if (!posTd.classList.contains('material-icons')) {
|
||||
posTd.classList.add('material-icons');
|
||||
posTd.innerText = 'play_arrow';
|
||||
console.log('A');
|
||||
}
|
||||
}
|
||||
tr.classList.add('font-weight-bold');
|
||||
@@ -1377,9 +1412,23 @@ function parseFilesystem(obj) {
|
||||
|
||||
switch(obj.data[i].Type) {
|
||||
case 'dir':
|
||||
row.innerHTML = '<td><span class="material-icons">folder_open</span></td>' +
|
||||
'<td colspan="' + colspan + '">' + obj.data[i].name + '</td>' +
|
||||
'<td><a href="#" class="material-icons color-darkgrey">playlist_add</a></td>';
|
||||
case 'smartpls':
|
||||
case 'plist':
|
||||
var tds = '';
|
||||
for (var c = 0; c < settings['cols' + list].length; c++) {
|
||||
tds += '<td data-col="' + settings['cols' + list][c] + '">';
|
||||
if (settings['cols' + list][c] == 'Type') {
|
||||
if (obj.data[i].Type == 'dir')
|
||||
tds += '<span class="material-icons">folder_open</span>';
|
||||
else
|
||||
tds += '<span class="material-icons">list</span>';
|
||||
}
|
||||
else if (settings['cols' + list][c] == 'Title')
|
||||
tds += obj.data[i].name;
|
||||
tds += '</td>';
|
||||
}
|
||||
tds += '<td data-col="Action"><a href="#" class="material-icons color-darkgrey">playlist_add</a></td>';
|
||||
row.innerHTML = tds;
|
||||
break;
|
||||
case 'song':
|
||||
var minutes = Math.floor(obj.data[i].Duration / 60);
|
||||
@@ -1397,12 +1446,6 @@ function parseFilesystem(obj) {
|
||||
tds += '<td data-col="Action"><a href="#" class="material-icons color-darkgrey">playlist_add</a></td>';
|
||||
row.innerHTML = tds;
|
||||
break;
|
||||
case 'smartpls':
|
||||
case 'plist':
|
||||
row.innerHTML = '<td data-col="Type"><span class="material-icons">list</span></td>' +
|
||||
'<td colspan="' + colspan + '">' + obj.data[i].name + '</td>' +
|
||||
'<td data-col="Action"><a href="#" class="material-icons color-darkgrey">playlist_add</a></td>';
|
||||
break;
|
||||
}
|
||||
if (i < tr.length)
|
||||
tr[i].replaceWith(row);
|
||||
@@ -1801,7 +1844,7 @@ function parseSongDetails(obj) {
|
||||
|
||||
songDetails += '<tr><th>Uri</th><td><a class="text-success" href="/library/' + obj.data.uri + '">' + obj.data.uri + '</a></td></tr>';
|
||||
|
||||
if (settings.stickers == true) {
|
||||
if (settings.featStickers == true) {
|
||||
var like = 'not voted';
|
||||
if (obj.data.like == 0)
|
||||
like = '<span class="material-icons">thumb_down_alt</span>';
|
||||
@@ -1943,7 +1986,7 @@ function parseSmartPlaylist(obj) {
|
||||
}
|
||||
else if (obj.data.type == 'sticker') {
|
||||
document.getElementById('saveSmartPlaylistSticker').classList.remove('hide');
|
||||
document.getElementById('selectSaveSmartPlaylistSticker').value = obj.data.sticker;
|
||||
document.getElementById('selectSaveSmartPlaylistSticker').value = obj.data.feat_sticker;
|
||||
document.getElementById('inputSaveSmartPlaylistStickerMaxentries').value = obj.data.maxentries;
|
||||
}
|
||||
else if (obj.data.type == 'newest') {
|
||||
@@ -2033,8 +2076,10 @@ function showAddToPlaylist(uri) {
|
||||
document.getElementById('addToPlaylistLabel').innerText = 'Add Stream';
|
||||
}
|
||||
modalAddToPlaylist.show();
|
||||
playlistEl = 'addToPlaylistPlaylist';
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_LIST","data": {"offset": 0, "filter": "-"}}, getAllPlaylists);
|
||||
if (settings.featPlaylists) {
|
||||
playlistEl = 'addToPlaylistPlaylist';
|
||||
sendAPI({"cmd": "MPD_API_PLAYLIST_LIST","data": {"offset": 0, "filter": "-"}}, getAllPlaylists);
|
||||
}
|
||||
}
|
||||
|
||||
function addToPlaylist() {
|
||||
@@ -2172,7 +2217,7 @@ function showMenu(el, event) {
|
||||
menu += addMenuItem({"cmd": "appendQueue", "options": [type, uri, name]}, 'Append to queue') +
|
||||
(type == 'song' ? addMenuItem({"cmd": "appendAfterQueue", "options": [type, uri, nextsongpos, name]}, 'Add after current playing song') : '') +
|
||||
addMenuItem({"cmd": "replaceQueue", "options": [type, uri, name]}, 'Replace queue') +
|
||||
(type != 'plist' && type != 'smartpls' ? addMenuItem({"cmd": "showAddToPlaylist", "options": [uri]}, 'Add to playlist') : '') +
|
||||
(type != 'plist' && type != 'smartpls' && settings.featPlaylists ? addMenuItem({"cmd": "showAddToPlaylist", "options": [uri]}, 'Add to playlist') : '') +
|
||||
(type == 'song' ? addMenuItem({"cmd": "songDetails", "options": [uri]}, 'Songdetails') : '') +
|
||||
(type == 'plist' || type == 'smartpls' ? addMenuItem({"cmd": "playlistDetails", "options": [uri]}, 'View playlist') : '');
|
||||
if (app.current.app == 'Search') {
|
||||
@@ -2183,7 +2228,7 @@ function showMenu(el, event) {
|
||||
addMenuItem({"cmd": "appendQueue", "options": [type, baseuri, name]}, 'Append to queue') +
|
||||
addMenuItem({"cmd": "appendAfterQueue", "options": [type, baseuri, nextsongpos, name]}, 'Add after current playing song') +
|
||||
addMenuItem({"cmd": "replaceQueue", "options": [type, baseuri, name]}, 'Replace queue') +
|
||||
addMenuItem({"cmd": "showAddToPlaylist", "options": [baseuri]}, 'Add to playlist') +
|
||||
(settings.featPlaylists ? addMenuItem({"cmd": "showAddToPlaylist", "options": [baseuri]}, 'Add to playlist') : '') +
|
||||
'</div>';
|
||||
}
|
||||
}
|
||||
@@ -2582,7 +2627,7 @@ function songChange(obj) {
|
||||
|
||||
document.title = pageTitle;
|
||||
|
||||
if (settings.stickers == true) {
|
||||
if (settings.featStickers == true) {
|
||||
setVoteSongBtns(obj.data.like, obj.data.uri);
|
||||
}
|
||||
|
||||
@@ -2656,8 +2701,12 @@ function selectTag(btnsEl, desc, setTo) {
|
||||
function addTagList(x, any) {
|
||||
var tagList = '';
|
||||
var tagBlacklist = ["Title", "MUSICBRAINZ_TRACKID", "Count", "Disc", "Comment", "Name"];
|
||||
if (any == true)
|
||||
tagList += '<button type="button" class="btn btn-secondary btn-sm btn-block" data-tag="any">Any Tag</button>';
|
||||
if (any == true) {
|
||||
if (settings.featTags == true)
|
||||
tagList += '<button type="button" class="btn btn-secondary btn-sm btn-block" data-tag="any">Any Tag</button>';
|
||||
else
|
||||
tagList += '<button type="button" class="btn btn-secondary btn-sm btn-block" data-tag="filename">Filename</button>';
|
||||
}
|
||||
for (var i = 0; i < settings.tags.length; i++) {
|
||||
if (settings.tags[i] == 'Track')
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user