update TODO; fix typo

This commit is contained in:
XenGi 2024-04-06 19:27:59 +02:00
parent 03677e24be
commit 899dde0754
Signed by: xengi
SSH key fingerprint: SHA256:jxWM2RTHvxxcncXycwwWkP7HCWb4VREN05UGJTbIPZg
2 changed files with 26 additions and 30 deletions

View file

@ -35,9 +35,8 @@
- [ ] `Clear queue` button? - [ ] `Clear queue` button?
- File browser - File browser
- [ ] List all directories - [ ] List all directories
- [ ] The selected folder has a different icon (📂 vs 📁) - [ ] Selected folder has different icon (📂 vs 📁)
- [ ] Folders with subfolders have a sign - [ ] Folders with subfolders have a or sign
- [ ] Expanded folders have a sign
- [ ] Clicked folders contents are displayed in the results - [ ] Clicked folders contents are displayed in the results
- [ ] Select tracks in results - [ ] Select tracks in results
- [ ] `Add` selected tracks to queue button - [ ] `Add` selected tracks to queue button
@ -63,22 +62,23 @@
- [ ] `#download` requests download of URL (`yt-dlp`) - [ ] `#download` requests download of URL (`yt-dlp`)
- *TBA* - *TBA*
- API endpoints - API endpoints
- [x] `/api/update_db` - [x] GET `/api/update_db`
- [x] `/api/previous_track` - [x] GET `/api/previous_track`
- [x] `/api/next_track` - [x] GET `/api/next_track`
- [x] `/api/stop` - [x] GET `/api/stop`
- [x] `/api/play` - [x] GET `/api/play`
- [x] `/api/pause` - [x] GET `/api/pause`
- [x] `/api/seek/:seconds` - [x] GET `/api/seek/:seconds`
- [x] `/api/repeat` - [x] GET `/api/repeat`
- [x] `/api/random` - [x] GET `/api/random`
- [x] `/api/volume/:level` - [x] GET `/api/volume/:level`
- [ ] `/api/xfade/:seconds` - [ ] `/api/xfade/:seconds`
- [ ] `/api/queue_clear` - [ ] `/api/queue_clear`
- [ ] `/api/queue_add/:songid` - [ ] POST `/api/queue` `{"song_id": 123}`
- [ ] `/api/queue_del/:songid` - [x] GET `/api/queue/:song_id/delete`
- [ ] `/api/queue_move/:songid/:pos` - [x] GET `/api/queue/:song_id/move/:position`
- [ ] `/api/list_database/:path` - [ ] `/api/list_database/:path`
- [ ] `/api/list_playlists` - [ ] `/api/list_playlists`
- [ ] `/api/save_playlist` - [ ] `/api/save_playlist`
- [ ] `/api/delete_playlist` - [ ] `/api/delete_playlist`

View file

@ -152,12 +152,12 @@ control_delete_playlist.addEventListener("click", () => {
}); });
}); });
control_update_db.addEventListener("click", () => { control_update_db.addEventListener("click", event => {
console.log("Issuing database update") console.log("Issuing database update")
fetch(`${API_URL}/update_db`).then(async r => { fetch(`${API_URL}/update_db`).then(async r => {
if (r.status === 200) { if (r.status === 200) {
console.log(await r.text()); console.log(await r.text());
e.target.disabled = true; event.target.disabled = true;
} else { } else {
console.error(`API returned ${r.status}: ${r.statusText}`); console.error(`API returned ${r.status}: ${r.statusText}`);
} }
@ -420,32 +420,28 @@ socket.addEventListener("message", event => {
const length = document.createElement("td"); const length = document.createElement("td");
length.innerText = secondsToTrackTime(song.duration); length.innerText = secondsToTrackTime(song.duration);
const actions = document.createElement("td"); const actions = document.createElement("td");
if (parseInt(song.Pos) !== 0) {
const moveUp = document.createElement("button"); const moveUp = document.createElement("button");
moveUp.classList.add("borderless"); moveUp.classList.add("borderless");
if (parseInt(song.Pos) !== 0) {
moveUp.innerHTML = "🔺"; // 🔺 Red Triangle Pointed Down moveUp.innerHTML = "🔺"; // 🔺 Red Triangle Pointed Down
moveUp.addEventListener("click", event => { moveTrackInQueue(event, -1) }); moveUp.addEventListener("click", event => { moveTrackInQueue(event, -1) });
actions.appendChild(moveUp);
} else { } else {
const spacer = document.createElement("span") moveUp.innerHTML = " ";
spacer.innerHTML = " ";
actions.appendChild(spacer);
} }
if (parseInt(song.Pos) !== msg.mpd_queue.length - 1) {
const moveDown = document.createElement("button"); const moveDown = document.createElement("button");
moveDown.classList.add("borderless"); moveDown.classList.add("borderless");
if (parseInt(song.Pos) !== msg.mpd_queue.length - 1) {
moveDown.innerHTML = "🔻"; // 🔻 Red Triangle Pointed Up moveDown.innerHTML = "🔻"; // 🔻 Red Triangle Pointed Up
moveDown.addEventListener("click", event => {moveTrackInQueue(event, 1)}); moveDown.addEventListener("click", event => {moveTrackInQueue(event, 1)});
actions.appendChild(moveDown);
} else { } else {
const spacer = document.createElement("span") moveDown.innerHTML = " ";
spacer.innerHTML = " ";
actions.appendChild(spacer);
} }
const remove = document.createElement("button"); const remove = document.createElement("button");
remove.classList.add("borderless"); remove.classList.add("borderless");
remove.innerHTML = "❌"; // ❌ Cross mark remove.innerHTML = "❌"; // ❌ Cross mark
remove.addEventListener("click", removeTrackFromQueue); remove.addEventListener("click", removeTrackFromQueue);
actions.appendChild(moveUp);
actions.appendChild(moveDown);
actions.appendChild(remove); actions.appendChild(remove);
tr.appendChild(pos); tr.appendChild(pos);
tr.appendChild(artist); tr.appendChild(artist);