1
0
mirror of https://github.com/SuperBFG7/ympd synced 2025-11-02 14:53:00 +00:00

Feat: add rescan database command

This commit is contained in:
jcorporation
2018-09-23 22:48:12 +01:00
parent 006eb6d28c
commit f71bef42fe
5 changed files with 36 additions and 1 deletions

View File

@@ -128,6 +128,12 @@ small {
font-feature-settings: 'liga';
}
.material-icons-left {
font-size: 1rem;
margin-left: -1em;
vertical-align:middle;
}
.material-icons-small {
font-size: 16px;
}
@@ -281,3 +287,7 @@ caption {
width:100%;
margin-left: 15px;
}
#menu-dbupdate {
padding-left:1rem;
}

View File

@@ -24,7 +24,11 @@
</a>
<div class="dropdown-menu bg-dark">
<a class="dropdown-item text-light bg-dark" href="#" data-href='{"cmd": "showAddToPlaylist", "options": ["stream"]}'>Add Stream</a>
<a class="dropdown-item text-light bg-dark" href="#" data-href='{"cmd": "updateDB", "options": []}'>Update Database</a>
<a id="navDBupdate" class="dropdown-item text-light bg-dark" data-toggle="collapse" href="#menu-dbupdate"><span class="material-icons material-icons-left">keyboard_arrow_right</span>Database</a>
<div class="collapse" id="menu-dbupdate">
<a class="dropdown-item text-light bg-dark" href="#" data-href='{"cmd": "updateDB", "options": []}'>Update</a>
<a class="dropdown-item text-light bg-dark" href="#" data-href='{"cmd": "rescanDB", "options": []}'>Rescan</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>
<a class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#modalAbout">About</a>

View File

@@ -309,6 +309,16 @@ function appInit() {
sendAPI({"cmd": "MPD_API_PLAYER_SEEK", "data": {"songid": currentSong.currentSongId, "seek": seekVal}});
}
}, false);
document.getElementById('navDBupdate').addEventListener('click', function(event) {
event.stopPropagation();
event.preventDefault();
var icon = this.getElementsByTagName('span')[0];
if (icon.innerText == 'keyboard_arrow_right')
icon.innerText = 'keyboard_arrow_down';
else
icon.innerText = 'keyboard_arrow_right';
}, false);
document.getElementById('volumeIcon').parentNode.addEventListener('show.bs.dropdown', function () {
sendAPI({"cmd": "MPD_API_PLAYER_OUTPUT_LIST"}, parseOutputs);
@@ -1840,6 +1850,11 @@ function updateDB() {
updateDBstarted(true);
}
function rescanDB() {
sendAPI({"cmd": "MPD_API_DATABASE_RESCAN"});
updateDBstarted(true);
}
function updateDBstarted(showModal) {
if (showModal == true) {
document.getElementById('updateDBfinished').innerText = '';