mirror of
https://github.com/SuperBFG7/ympd
synced 2025-04-01 08:17:05 +00:00
This commit is contained in:
parent
c5856c0cbd
commit
58d1782cf7
@ -28,7 +28,7 @@
|
|||||||
<div class="collapse" id="menu-dbupdate">
|
<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": "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": "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>
|
</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-href='{"cmd": "openLocalPlayer", "options": []}'>Local Player</a>
|
||||||
<a class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#modalSettings">Settings</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" id="cardPlayback">
|
||||||
<div class="card-header">Playback
|
<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="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>
|
<button title="Like song" id="btnVoteUp" data-href='{"cmd": "voteSong", "options": [2]}' class="btn btn-sm btn-light material-icons">thumb_up</button>
|
||||||
</div>
|
</div>
|
||||||
@ -90,12 +90,14 @@
|
|||||||
<div class="album-cover" id="currentCover"></div>
|
<div class="album-cover" id="currentCover"></div>
|
||||||
<div class="album-desc">
|
<div class="album-desc">
|
||||||
<h2 id="currentTrack" data-href='{"cmd": "songClick", "options": []}'></h2>
|
<h2 id="currentTrack" data-href='{"cmd": "songClick", "options": []}'></h2>
|
||||||
|
<div class="featTags">
|
||||||
<small>Artist</small>
|
<small>Artist</small>
|
||||||
<h4 id="currentArtist" data-href='{"cmd": "artistClick", "options": []}'></h4>
|
<h4 id="currentArtist" data-href='{"cmd": "artistClick", "options": []}'></h4>
|
||||||
<small>Album</small>
|
<small>Album</small>
|
||||||
<h4 id="currentAlbum" data-href='{"cmd": "albumClick", "options": []}'></h4>
|
<h4 id="currentAlbum" data-href='{"cmd": "albumClick", "options": []}'></h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="card-footer card-footer-playback">
|
<div class="card-footer card-footer-playback">
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<button data-href='{"cmd": "clickPlay", "options": []}' class="mr-1 ml-1 btn btn-light material-icons btnPlay progressBarPlay">pause</button>
|
<button data-href='{"cmd": "clickPlay", "options": []}' class="mr-1 ml-1 btn btn-light material-icons btnPlay progressBarPlay">pause</button>
|
||||||
@ -111,7 +113,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="btn-toolbar card-toolbar" id="queue-buttons">
|
<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">
|
<button type="button" class="btn btn-secondary material-icons" data-toggle="modal" data-target="#modalSaveQueue" title="Save queue">
|
||||||
save
|
save
|
||||||
</button>
|
</button>
|
||||||
@ -199,10 +201,10 @@
|
|||||||
<div class="card hide" id="cardBrowse">
|
<div class="card hide" id="cardBrowse">
|
||||||
<div class="card-header" id="panel-heading-browse">
|
<div class="card-header" id="panel-heading-browse">
|
||||||
<ul class="nav nav-tabs card-header-tabs">
|
<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>
|
<a data-href='{"cmd": "appGoto", "options": ["Browse", "Database"]}' class="nav-link text-dark" href="#" id="cardBrowseNavDatabase">Database</a>
|
||||||
</li>
|
</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>
|
<a data-href='{"cmd": "appGoto", "options": ["Browse", "Playlists"]}' class="nav-link text-dark" href="#" id="cardBrowseNavPlaylists">Playlists</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<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>
|
<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">
|
<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 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>
|
</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>
|
<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">
|
<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 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>
|
</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>
|
<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">
|
<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 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>
|
||||||
<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 featSmartpls">Save as smart playlist</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -580,7 +582,7 @@
|
|||||||
<div class="invalid-feedback">Invalid uri</div>
|
<div class="invalid-feedback">Invalid uri</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row featPlaylists">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<button id="toggleAddToPlaylistBtn" class="btn btn-secondary" data-href='{"cmd": "toggleAddToPlaylistFrm", "options":[]}'>Add to playlist</button>
|
<button id="toggleAddToPlaylistBtn" class="btn btn-secondary" data-href='{"cmd": "toggleAddToPlaylistFrm", "options":[]}'>Add to playlist</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -943,6 +943,24 @@ function toggleBtn(btn, state) {
|
|||||||
b.classList.remove('active');
|
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) {
|
function parseSettings(obj) {
|
||||||
toggleBtn('btnRandom', obj.data.random);
|
toggleBtn('btnRandom', obj.data.random);
|
||||||
toggleBtn('btnConsume', obj.data.consume);
|
toggleBtn('btnConsume', obj.data.consume);
|
||||||
@ -995,17 +1013,20 @@ function parseSettings(obj) {
|
|||||||
|
|
||||||
toggleBtn('btnnotifyPage', obj.data.notificationPage);
|
toggleBtn('btnnotifyPage', obj.data.notificationPage);
|
||||||
|
|
||||||
var stickerEls = document.getElementsByClassName('stickers');
|
var features = ["featStickers", "featSmartpls", "featPlaylists", "featTags"];
|
||||||
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');
|
for (var j = 0; j < features.length; j++) {
|
||||||
var smartplsElsLen = smartplsEls.length;
|
var Els = document.getElementsByClassName(features[j]);
|
||||||
var displaySmartpls = obj.data.smartpls == true ? '' : 'none';
|
var ElsLen = Els.length;
|
||||||
for (var i = 0; i < smartplsElsLen; i++)
|
var displayEl = obj.data[features[j]] == true ? '' : 'none';
|
||||||
smartplsEls[i].style.display = displaySmartpls;
|
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)
|
if (obj.data.mixramp == true)
|
||||||
document.getElementsByClassName('mixramp')[0].style.display = '';
|
document.getElementsByClassName('mixramp')[0].style.display = '';
|
||||||
@ -1025,8 +1046,17 @@ function parseSettings(obj) {
|
|||||||
|
|
||||||
settings = obj.data;
|
settings = obj.data;
|
||||||
|
|
||||||
|
if (obj.data.featPlaylists) {
|
||||||
playlistEl = 'selectJukeboxPlaylist';
|
playlistEl = 'selectJukeboxPlaylist';
|
||||||
sendAPI({"cmd": "MPD_API_PLAYLIST_LIST", "data": {"offset": 0, "filter": "-"}}, getAllPlaylists);
|
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://';
|
settings.mpdstream = 'http://';
|
||||||
if (settings.mpdhost == '127.0.0.1' || settings.mpdhost == 'localhost')
|
if (settings.mpdhost == '127.0.0.1' || settings.mpdhost == 'localhost')
|
||||||
@ -1069,9 +1099,13 @@ function parseSettings(obj) {
|
|||||||
function setCols(table) {
|
function setCols(table) {
|
||||||
var tagChks = '';
|
var tagChks = '';
|
||||||
var tags = settings.tags.slice();
|
var tags = settings.tags.slice();
|
||||||
|
if (settings.featTags == false)
|
||||||
|
tags.push('Title');
|
||||||
tags.push('Duration');
|
tags.push('Duration');
|
||||||
if (table == 'Queue' || table == 'BrowsePlaylistsDetail')
|
if (table == 'Queue' || table == 'BrowsePlaylistsDetail')
|
||||||
tags.push('Pos');
|
tags.push('Pos');
|
||||||
|
if (table == 'BrowseFilesystem')
|
||||||
|
tags.push('Type');
|
||||||
|
|
||||||
for (var i = 0; i < tags.length; i++) {
|
for (var i = 0; i < tags.length; i++) {
|
||||||
tagChks += '<div class="form-check">' +
|
tagChks += '<div class="form-check">' +
|
||||||
@ -1086,11 +1120,13 @@ function setCols(table) {
|
|||||||
|
|
||||||
var heading = '';
|
var heading = '';
|
||||||
for (var i = 0; i < settings['cols' + table].length; i++) {
|
for (var i = 0; i < settings['cols' + table].length; i++) {
|
||||||
|
// if (tags.includes(settings['cols' + table][i])) {
|
||||||
var h = settings['cols' + table][i];
|
var h = settings['cols' + table][i];
|
||||||
heading += '<th draggable="true" data-col="' + h + '">';
|
heading += '<th draggable="true" data-col="' + h + '">';
|
||||||
if (h == 'Track' || h == 'Pos')
|
if (h == 'Track' || h == 'Pos')
|
||||||
h = '#';
|
h = '#';
|
||||||
heading += h + '</th>';
|
heading += h + '</th>';
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
heading += '<th></th>';
|
heading += '<th></th>';
|
||||||
document.getElementById(table + 'List').getElementsByTagName('tr')[0].innerHTML = heading;
|
document.getElementById(table + 'List').getElementsByTagName('tr')[0].innerHTML = heading;
|
||||||
@ -1183,7 +1219,6 @@ function setCounter(currentSongId, totalTime, elapsedTime) {
|
|||||||
if (!posTd.classList.contains('material-icons')) {
|
if (!posTd.classList.contains('material-icons')) {
|
||||||
posTd.classList.add('material-icons');
|
posTd.classList.add('material-icons');
|
||||||
posTd.innerText = 'play_arrow';
|
posTd.innerText = 'play_arrow';
|
||||||
console.log('A');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tr.classList.add('font-weight-bold');
|
tr.classList.add('font-weight-bold');
|
||||||
@ -1377,9 +1412,23 @@ function parseFilesystem(obj) {
|
|||||||
|
|
||||||
switch(obj.data[i].Type) {
|
switch(obj.data[i].Type) {
|
||||||
case 'dir':
|
case 'dir':
|
||||||
row.innerHTML = '<td><span class="material-icons">folder_open</span></td>' +
|
case 'smartpls':
|
||||||
'<td colspan="' + colspan + '">' + obj.data[i].name + '</td>' +
|
case 'plist':
|
||||||
'<td><a href="#" class="material-icons color-darkgrey">playlist_add</a></td>';
|
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;
|
break;
|
||||||
case 'song':
|
case 'song':
|
||||||
var minutes = Math.floor(obj.data[i].Duration / 60);
|
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>';
|
tds += '<td data-col="Action"><a href="#" class="material-icons color-darkgrey">playlist_add</a></td>';
|
||||||
row.innerHTML = tds;
|
row.innerHTML = tds;
|
||||||
break;
|
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)
|
if (i < tr.length)
|
||||||
tr[i].replaceWith(row);
|
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>';
|
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';
|
var like = 'not voted';
|
||||||
if (obj.data.like == 0)
|
if (obj.data.like == 0)
|
||||||
like = '<span class="material-icons">thumb_down_alt</span>';
|
like = '<span class="material-icons">thumb_down_alt</span>';
|
||||||
@ -1943,7 +1986,7 @@ function parseSmartPlaylist(obj) {
|
|||||||
}
|
}
|
||||||
else if (obj.data.type == 'sticker') {
|
else if (obj.data.type == 'sticker') {
|
||||||
document.getElementById('saveSmartPlaylistSticker').classList.remove('hide');
|
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;
|
document.getElementById('inputSaveSmartPlaylistStickerMaxentries').value = obj.data.maxentries;
|
||||||
}
|
}
|
||||||
else if (obj.data.type == 'newest') {
|
else if (obj.data.type == 'newest') {
|
||||||
@ -2033,9 +2076,11 @@ function showAddToPlaylist(uri) {
|
|||||||
document.getElementById('addToPlaylistLabel').innerText = 'Add Stream';
|
document.getElementById('addToPlaylistLabel').innerText = 'Add Stream';
|
||||||
}
|
}
|
||||||
modalAddToPlaylist.show();
|
modalAddToPlaylist.show();
|
||||||
|
if (settings.featPlaylists) {
|
||||||
playlistEl = 'addToPlaylistPlaylist';
|
playlistEl = 'addToPlaylistPlaylist';
|
||||||
sendAPI({"cmd": "MPD_API_PLAYLIST_LIST","data": {"offset": 0, "filter": "-"}}, getAllPlaylists);
|
sendAPI({"cmd": "MPD_API_PLAYLIST_LIST","data": {"offset": 0, "filter": "-"}}, getAllPlaylists);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function addToPlaylist() {
|
function addToPlaylist() {
|
||||||
var uri = document.getElementById('addToPlaylistUri').value;
|
var uri = document.getElementById('addToPlaylistUri').value;
|
||||||
@ -2172,7 +2217,7 @@ function showMenu(el, event) {
|
|||||||
menu += addMenuItem({"cmd": "appendQueue", "options": [type, uri, name]}, 'Append to queue') +
|
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') : '') +
|
(type == 'song' ? addMenuItem({"cmd": "appendAfterQueue", "options": [type, uri, nextsongpos, name]}, 'Add after current playing song') : '') +
|
||||||
addMenuItem({"cmd": "replaceQueue", "options": [type, uri, name]}, 'Replace queue') +
|
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 == 'song' ? addMenuItem({"cmd": "songDetails", "options": [uri]}, 'Songdetails') : '') +
|
||||||
(type == 'plist' || type == 'smartpls' ? addMenuItem({"cmd": "playlistDetails", "options": [uri]}, 'View playlist') : '');
|
(type == 'plist' || type == 'smartpls' ? addMenuItem({"cmd": "playlistDetails", "options": [uri]}, 'View playlist') : '');
|
||||||
if (app.current.app == 'Search') {
|
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": "appendQueue", "options": [type, baseuri, name]}, 'Append to queue') +
|
||||||
addMenuItem({"cmd": "appendAfterQueue", "options": [type, baseuri, nextsongpos, name]}, 'Add after current playing song') +
|
addMenuItem({"cmd": "appendAfterQueue", "options": [type, baseuri, nextsongpos, name]}, 'Add after current playing song') +
|
||||||
addMenuItem({"cmd": "replaceQueue", "options": [type, baseuri, name]}, 'Replace queue') +
|
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>';
|
'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2582,7 +2627,7 @@ function songChange(obj) {
|
|||||||
|
|
||||||
document.title = pageTitle;
|
document.title = pageTitle;
|
||||||
|
|
||||||
if (settings.stickers == true) {
|
if (settings.featStickers == true) {
|
||||||
setVoteSongBtns(obj.data.like, obj.data.uri);
|
setVoteSongBtns(obj.data.like, obj.data.uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2656,8 +2701,12 @@ function selectTag(btnsEl, desc, setTo) {
|
|||||||
function addTagList(x, any) {
|
function addTagList(x, any) {
|
||||||
var tagList = '';
|
var tagList = '';
|
||||||
var tagBlacklist = ["Title", "MUSICBRAINZ_TRACKID", "Count", "Disc", "Comment", "Name"];
|
var tagBlacklist = ["Title", "MUSICBRAINZ_TRACKID", "Count", "Disc", "Comment", "Name"];
|
||||||
if (any == true)
|
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>';
|
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++) {
|
for (var i = 0; i < settings.tags.length; i++) {
|
||||||
if (settings.tags[i] == 'Track')
|
if (settings.tags[i] == 'Track')
|
||||||
continue;
|
continue;
|
||||||
|
@ -726,11 +726,15 @@ void mympd_mpd_features() {
|
|||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
mpd.feat_sticker = false;
|
mpd.feat_sticker = false;
|
||||||
|
mpd.feat_playlists = false;
|
||||||
|
mpd.feat_tags = false;
|
||||||
|
|
||||||
mpd_send_allowed_commands(mpd.conn);
|
mpd_send_allowed_commands(mpd.conn);
|
||||||
while ((pair = mpd_recv_command_pair(mpd.conn)) != NULL) {
|
while ((pair = mpd_recv_command_pair(mpd.conn)) != NULL) {
|
||||||
if (strcmp(pair->value, "sticker") == 0)
|
if (strcmp(pair->value, "sticker") == 0)
|
||||||
mpd.feat_sticker = true;
|
mpd.feat_sticker = true;
|
||||||
|
if (strcmp(pair->value, "listplaylists") == 0)
|
||||||
|
mpd.feat_playlists = true;
|
||||||
mpd_return_pair(mpd.conn, pair);
|
mpd_return_pair(mpd.conn, pair);
|
||||||
}
|
}
|
||||||
mpd_response_finish(mpd.conn);
|
mpd_response_finish(mpd.conn);
|
||||||
@ -743,6 +747,10 @@ void mympd_mpd_features() {
|
|||||||
printf("Stickers are disabled, disabling smartplaylists\n");
|
printf("Stickers are disabled, disabling smartplaylists\n");
|
||||||
config.smartpls = false;
|
config.smartpls = false;
|
||||||
}
|
}
|
||||||
|
if (mpd.feat_playlists == false && config.smartpls == true) {
|
||||||
|
printf("Playlists are disabled, disabling smartplaylists\n");
|
||||||
|
config.smartpls = false;
|
||||||
|
}
|
||||||
|
|
||||||
printf("MPD supported tags: ");
|
printf("MPD supported tags: ");
|
||||||
list_free(&mpd_tags);
|
list_free(&mpd_tags);
|
||||||
@ -753,9 +761,14 @@ void mympd_mpd_features() {
|
|||||||
mpd_return_pair(mpd.conn, pair);
|
mpd_return_pair(mpd.conn, pair);
|
||||||
}
|
}
|
||||||
mpd_response_finish(mpd.conn);
|
mpd_response_finish(mpd.conn);
|
||||||
printf("\nmyMPD enabled tags: ");
|
|
||||||
|
|
||||||
list_free(&mympd_tags);
|
list_free(&mympd_tags);
|
||||||
|
if (mpd_tags.length == 0) {
|
||||||
|
printf("none\nTags are disabled\n");
|
||||||
|
mpd.feat_tags = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mpd.feat_tags = true;
|
||||||
|
printf("\nmyMPD enabled tags: ");
|
||||||
token = strtok(str, s);
|
token = strtok(str, s);
|
||||||
while (token != NULL) {
|
while (token != NULL) {
|
||||||
if (list_get_value(&mpd_tags, token) == 1) {
|
if (list_get_value(&mpd_tags, token) == 1) {
|
||||||
@ -765,6 +778,7 @@ void mympd_mpd_features() {
|
|||||||
token = strtok(NULL, s);
|
token = strtok(NULL, s);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
}
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1016,6 +1030,11 @@ void mympd_jukebox() {
|
|||||||
if (addSongs < 1)
|
if (addSongs < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (mpd.feat_playlists == false && strcmp(mympd_state.jukeboxPlaylist, "Database") != 0) {
|
||||||
|
printf("Jukebox: Playlists are disabled\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
srand((unsigned int)time(NULL));
|
srand((unsigned int)time(NULL));
|
||||||
|
|
||||||
struct list add_list;
|
struct list add_list;
|
||||||
@ -1025,7 +1044,7 @@ void mympd_jukebox() {
|
|||||||
//add songs
|
//add songs
|
||||||
if (strcmp(mympd_state.jukeboxPlaylist, "Database") == 0) {
|
if (strcmp(mympd_state.jukeboxPlaylist, "Database") == 0) {
|
||||||
if (!mpd_send_list_all(mpd.conn, "/")) {
|
if (!mpd_send_list_all(mpd.conn, "/")) {
|
||||||
LOG_ERROR_AND_RECOVER("mpd_send_list_playlist");
|
LOG_ERROR_AND_RECOVER("mpd_send_list_all");
|
||||||
list_free(&add_list);
|
list_free(&add_list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1067,12 +1086,12 @@ void mympd_jukebox() {
|
|||||||
else if (mympd_state.jukeboxMode == 2) {
|
else if (mympd_state.jukeboxMode == 2) {
|
||||||
//add album
|
//add album
|
||||||
if (!mpd_search_db_tags(mpd.conn, MPD_TAG_ALBUM)) {
|
if (!mpd_search_db_tags(mpd.conn, MPD_TAG_ALBUM)) {
|
||||||
LOG_ERROR_AND_RECOVER("mpd_send_list_playlist");
|
LOG_ERROR_AND_RECOVER("mpd_search_db_tags");
|
||||||
list_free(&add_list);
|
list_free(&add_list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!mpd_search_commit(mpd.conn)) {
|
if (!mpd_search_commit(mpd.conn)) {
|
||||||
LOG_ERROR_AND_RECOVER("mpd_send_list_playlist");
|
LOG_ERROR_AND_RECOVER("mpd_search_commit");
|
||||||
list_free(&add_list);
|
list_free(&add_list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1305,8 +1324,8 @@ int mympd_put_settings(char *buffer) {
|
|||||||
|
|
||||||
len = json_printf(&out, "{type: settings, data: {"
|
len = json_printf(&out, "{type: settings, data: {"
|
||||||
"repeat: %d, single: %d, crossfade: %d, consume: %d, random: %d, "
|
"repeat: %d, single: %d, crossfade: %d, consume: %d, random: %d, "
|
||||||
"mixrampdb: %f, mixrampdelay: %f, mpdhost: %Q, mpdport: %d, passwort_set: %B, "
|
"mixrampdb: %f, mixrampdelay: %f, mpdhost: %Q, mpdport: %d, passwort_set: %B, featPlaylists: %B, featTags: %B, "
|
||||||
"streamport: %d, coverimage: %Q, stickers: %B, mixramp: %B, smartpls: %B, maxElementsPerPage: %d, "
|
"streamport: %d, coverimage: %Q, featStickers: %B, mixramp: %B, featSmartpls: %B, maxElementsPerPage: %d, "
|
||||||
"replaygain: %Q, notificationWeb: %B, notificationPage: %B, jukeboxMode: %d, jukeboxPlaylist: %Q, jukeboxQueueLength: %d, "
|
"replaygain: %Q, notificationWeb: %B, notificationPage: %B, jukeboxMode: %d, jukeboxPlaylist: %Q, jukeboxQueueLength: %d, "
|
||||||
"tags: [",
|
"tags: [",
|
||||||
mpd_status_get_repeat(status),
|
mpd_status_get_repeat(status),
|
||||||
@ -1319,6 +1338,8 @@ int mympd_put_settings(char *buffer) {
|
|||||||
config.mpdhost,
|
config.mpdhost,
|
||||||
config.mpdport,
|
config.mpdport,
|
||||||
config.mpdpass ? "true" : "false",
|
config.mpdpass ? "true" : "false",
|
||||||
|
mpd.feat_playlists,
|
||||||
|
mpd.feat_tags,
|
||||||
config.streamport,
|
config.streamport,
|
||||||
config.coverimage,
|
config.coverimage,
|
||||||
config.stickers,
|
config.stickers,
|
||||||
@ -1457,7 +1478,10 @@ int mympd_put_current_song(char *buffer) {
|
|||||||
mpd.song_id,
|
mpd.song_id,
|
||||||
cover
|
cover
|
||||||
);
|
);
|
||||||
|
if (mpd.feat_tags == true)
|
||||||
PUT_SONG_TAGS();
|
PUT_SONG_TAGS();
|
||||||
|
else
|
||||||
|
PUT_MIN_SONG_TAGS();
|
||||||
|
|
||||||
mpd_response_finish(mpd.conn);
|
mpd_response_finish(mpd.conn);
|
||||||
|
|
||||||
@ -1493,7 +1517,10 @@ int mympd_put_songdetails(char *buffer, char *uri) {
|
|||||||
song = mpd_entity_get_song(entity);
|
song = mpd_entity_get_song(entity);
|
||||||
mympd_get_cover(uri, cover, 500);
|
mympd_get_cover(uri, cover, 500);
|
||||||
len += json_printf(&out, "cover: %Q, ", cover);
|
len += json_printf(&out, "cover: %Q, ", cover);
|
||||||
|
if (mpd.feat_tags == true)
|
||||||
PUT_SONG_TAGS();
|
PUT_SONG_TAGS();
|
||||||
|
else
|
||||||
|
PUT_MIN_SONG_TAGS();
|
||||||
mpd_entity_free(entity);
|
mpd_entity_free(entity);
|
||||||
}
|
}
|
||||||
mpd_response_finish(mpd.conn);
|
mpd_response_finish(mpd.conn);
|
||||||
@ -1546,7 +1573,10 @@ int mympd_put_queue(char *buffer, unsigned int offset, unsigned *queue_version,
|
|||||||
mpd_song_get_id(song),
|
mpd_song_get_id(song),
|
||||||
mpd_song_get_pos(song)
|
mpd_song_get_pos(song)
|
||||||
);
|
);
|
||||||
|
if (mpd.feat_tags == true)
|
||||||
PUT_SONG_TAGS();
|
PUT_SONG_TAGS();
|
||||||
|
else
|
||||||
|
PUT_MIN_SONG_TAGS();
|
||||||
len += json_printf(&out, "}");
|
len += json_printf(&out, "}");
|
||||||
}
|
}
|
||||||
mpd_entity_free(entity);
|
mpd_entity_free(entity);
|
||||||
@ -1602,7 +1632,11 @@ int mympd_put_browse(char *buffer, char *path, unsigned int offset, char *filter
|
|||||||
if (entities_returned++)
|
if (entities_returned++)
|
||||||
len += json_printf(&out, ",");
|
len += json_printf(&out, ",");
|
||||||
len += json_printf(&out, "{Type: song, ");
|
len += json_printf(&out, "{Type: song, ");
|
||||||
|
if (mpd.feat_tags == true)
|
||||||
PUT_SONG_TAGS();
|
PUT_SONG_TAGS();
|
||||||
|
else
|
||||||
|
PUT_MIN_SONG_TAGS();
|
||||||
|
|
||||||
len += json_printf(&out, "}");
|
len += json_printf(&out, "}");
|
||||||
} else {
|
} else {
|
||||||
entity_count--;
|
entity_count--;
|
||||||
@ -1876,7 +1910,10 @@ int mympd_put_playlist_list(char *buffer, char *uri, unsigned int offset, char *
|
|||||||
if (entities_returned++)
|
if (entities_returned++)
|
||||||
len += json_printf(&out, ",");
|
len += json_printf(&out, ",");
|
||||||
len += json_printf(&out, "{Type: song, ");
|
len += json_printf(&out, "{Type: song, ");
|
||||||
|
if (mpd.feat_tags == true)
|
||||||
PUT_SONG_TAGS();
|
PUT_SONG_TAGS();
|
||||||
|
else
|
||||||
|
PUT_MIN_SONG_TAGS();
|
||||||
len += json_printf(&out, ", Pos: %d", entity_count);
|
len += json_printf(&out, ", Pos: %d", entity_count);
|
||||||
len += json_printf(&out, "}");
|
len += json_printf(&out, "}");
|
||||||
} else {
|
} else {
|
||||||
@ -1931,7 +1968,10 @@ int mympd_search(char *buffer, char *searchstr, char *filter, char *plist, unsig
|
|||||||
if (entities_returned++)
|
if (entities_returned++)
|
||||||
len += json_printf(&out, ", ");
|
len += json_printf(&out, ", ");
|
||||||
len += json_printf(&out, "{Type: song, ");
|
len += json_printf(&out, "{Type: song, ");
|
||||||
|
if (mpd.feat_tags == true)
|
||||||
PUT_SONG_TAGS();
|
PUT_SONG_TAGS();
|
||||||
|
else
|
||||||
|
PUT_MIN_SONG_TAGS();
|
||||||
len += json_printf(&out, "}");
|
len += json_printf(&out, "}");
|
||||||
}
|
}
|
||||||
mpd_song_free(song);
|
mpd_song_free(song);
|
||||||
@ -2017,7 +2057,10 @@ int mympd_search_queue(char *buffer, char *mpdtagtype, unsigned int offset, char
|
|||||||
mpd_song_get_id(song),
|
mpd_song_get_id(song),
|
||||||
mpd_song_get_pos(song)
|
mpd_song_get_pos(song)
|
||||||
);
|
);
|
||||||
|
if (mpd.feat_tags == true)
|
||||||
PUT_SONG_TAGS();
|
PUT_SONG_TAGS();
|
||||||
|
else
|
||||||
|
PUT_MIN_SONG_TAGS();
|
||||||
len += json_printf(&out, "}");
|
len += json_printf(&out, "}");
|
||||||
mpd_song_free(song);
|
mpd_song_free(song);
|
||||||
}
|
}
|
||||||
|
@ -29,17 +29,15 @@
|
|||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
#define RETURN_ERROR_AND_RECOVER(X) do { \
|
#define RETURN_ERROR_AND_RECOVER(X) do { \
|
||||||
printf("MPD X: %s\n", mpd_connection_get_error_message(mpd.conn)); \
|
printf("MPD %s: %s\n", X, mpd_connection_get_error_message(mpd.conn)); \
|
||||||
len = json_printf(&out, "{ type:error, data : %Q }", \
|
len = json_printf(&out, "{ type:error, data : %Q }", mpd_connection_get_error_message(mpd.conn)); \
|
||||||
mpd_connection_get_error_message(mpd.conn) \
|
|
||||||
); \
|
|
||||||
if (!mpd_connection_clear_error(mpd.conn)) \
|
if (!mpd_connection_clear_error(mpd.conn)) \
|
||||||
mpd.conn_state = MPD_FAILURE; \
|
mpd.conn_state = MPD_FAILURE; \
|
||||||
return len; \
|
return len; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define LOG_ERROR_AND_RECOVER(X) do { \
|
#define LOG_ERROR_AND_RECOVER(X) do { \
|
||||||
printf("MPD X: %s\n", mpd_connection_get_error_message(mpd.conn)); \
|
printf("MPD %s: %s\n", X, mpd_connection_get_error_message(mpd.conn)); \
|
||||||
if (!mpd_connection_clear_error(mpd.conn)) \
|
if (!mpd_connection_clear_error(mpd.conn)) \
|
||||||
mpd.conn_state = MPD_FAILURE; \
|
mpd.conn_state = MPD_FAILURE; \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -62,6 +60,10 @@
|
|||||||
len += json_printf(&out, ", Duration: %d, uri: %Q", mpd_song_get_duration(song), mpd_song_get_uri(song)); \
|
len += json_printf(&out, ", Duration: %d, uri: %Q", mpd_song_get_duration(song), mpd_song_get_uri(song)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define PUT_MIN_SONG_TAGS() do { \
|
||||||
|
len += json_printf(&out, "Title: %Q, Duration: %d, uri: %Q", mympd_get_tag(song, MPD_TAG_TITLE), mpd_song_get_duration(song), mpd_song_get_uri(song)); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#define MAX_SIZE 2048 * 400
|
#define MAX_SIZE 2048 * 400
|
||||||
#define MAX_ELEMENTS_PER_PAGE 400
|
#define MAX_ELEMENTS_PER_PAGE 400
|
||||||
@ -160,6 +162,8 @@ struct t_mpd {
|
|||||||
const unsigned* protocol;
|
const unsigned* protocol;
|
||||||
// Supported tags
|
// Supported tags
|
||||||
bool feat_sticker;
|
bool feat_sticker;
|
||||||
|
bool feat_playlists;
|
||||||
|
bool feat_tags;
|
||||||
} mpd;
|
} mpd;
|
||||||
|
|
||||||
struct list mpd_tags;
|
struct list mpd_tags;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user