mirror of
https://github.com/SuperBFG7/ympd
synced 2025-02-04 21:29:20 +00:00
Feat: add rescan database command
This commit is contained in:
parent
006eb6d28c
commit
f71bef42fe
@ -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;
|
||||
}
|
@ -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>
|
||||
|
@ -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 = '';
|
||||
|
@ -179,6 +179,11 @@ void callback_mympd(struct mg_connection *nc, const struct mg_str msg) {
|
||||
if (uint_rc > 0)
|
||||
n = snprintf(mpd.buf, MAX_SIZE, "{\"type\": \"result\", \"data\": \"ok\"}");
|
||||
break;
|
||||
case MPD_API_DATABASE_RESCAN:
|
||||
uint_rc = mpd_run_rescan(mpd.conn, NULL);
|
||||
if (uint_rc > 0)
|
||||
n = snprintf(mpd.buf, MAX_SIZE, "{\"type\": \"result\", \"data\": \"ok\"}");
|
||||
break;
|
||||
case MPD_API_PLAYER_PAUSE:
|
||||
mpd_run_toggle_pause(mpd.conn);
|
||||
n = snprintf(mpd.buf, MAX_SIZE, "{\"type\": \"result\", \"data\": \"ok\"}");
|
||||
|
@ -74,6 +74,7 @@
|
||||
X(MPD_API_PLAYLIST_CONTENT_LIST) \
|
||||
X(MPD_API_DATABASE_SEARCH) \
|
||||
X(MPD_API_DATABASE_UPDATE) \
|
||||
X(MPD_API_DATABASE_RESCAN) \
|
||||
X(MPD_API_DATABASE_FILESYSTEM_LIST) \
|
||||
X(MPD_API_DATABASE_TAG_LIST) \
|
||||
X(MPD_API_DATABASE_TAG_ALBUM_LIST) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user