Compare commits
	
		
			No commits in common. "671bcd300f99e08e0377aff71c7a082e2d3e0c8b" and "20c4dda1607b8f49f036d44c9de906d331884ac7" have entirely different histories.
		
	
	
		
			671bcd300f
			...
			20c4dda160
		
	
		
					 5 changed files with 25 additions and 27 deletions
				
			
		
							
								
								
									
										8
									
								
								NOTES.md
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								NOTES.md
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -7,13 +7,13 @@
 | 
			
		|||
  - [ ] Display config dialog (is this even needed?)
 | 
			
		||||
  - [x] `Update DB` button
 | 
			
		||||
    - [x] Disable if running update is detected
 | 
			
		||||
  - [x] `Previous Track` button
 | 
			
		||||
  - [x] `Next Track` button
 | 
			
		||||
  - [ ] `Previous Track` button
 | 
			
		||||
  - [ ] `Next Track` button
 | 
			
		||||
  - [x] `Stop` button
 | 
			
		||||
  - [x] `Play` button
 | 
			
		||||
    - [x] `Pause` button
 | 
			
		||||
    - [ ] `Pause` button
 | 
			
		||||
  - [x] Track seeker
 | 
			
		||||
  - [x] `Repeat` toggle
 | 
			
		||||
  - [ ] `Repeat` toggle
 | 
			
		||||
  - [ ] `Shuffle` toggle
 | 
			
		||||
  - [ ] xfade
 | 
			
		||||
    - [ ] decrease
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							| 
						 | 
				
			
			@ -43,11 +43,11 @@
 | 
			
		|||
    },
 | 
			
		||||
    "nixpkgs": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1708751719,
 | 
			
		||||
        "narHash": "sha256-0uWOKSpXJXmXswOvDM5Vk3blB74apFB6rNGWV5IjoN0=",
 | 
			
		||||
        "lastModified": 1705883077,
 | 
			
		||||
        "narHash": "sha256-ByzHHX3KxpU1+V0erFy8jpujTufimh6KaS/Iv3AciHk=",
 | 
			
		||||
        "owner": "NixOS",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "rev": "f63ce824cd2f036216eb5f637dfef31e1a03ee89",
 | 
			
		||||
        "rev": "5f5210aa20e343b7e35f40c033000db0ef80d7b9",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -124,7 +124,7 @@ func wsServe(c echo.Context) error {
 | 
			
		|||
				c.Logger().Error(err)
 | 
			
		||||
				break
 | 
			
		||||
			} else {
 | 
			
		||||
				// log.Print(msg)
 | 
			
		||||
				log.Println(msg)
 | 
			
		||||
				if strings.ToLower(msg) == "#status" {
 | 
			
		||||
					status, err := mpdConn.Status()
 | 
			
		||||
					if err != nil {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										30
									
								
								static/controls.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										30
									
								
								static/controls.js
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,5 +1,3 @@
 | 
			
		|||
// Configuration
 | 
			
		||||
 | 
			
		||||
const API_URL = `${document.location.protocol}//${document.location.host}/api`;
 | 
			
		||||
const VOLUME_STEP = 5;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -132,21 +130,21 @@ control_update_db.addEventListener("click", e => {
 | 
			
		|||
});
 | 
			
		||||
control_previous.addEventListener("click", e => {
 | 
			
		||||
  fetch(`${API_URL}/previous_track`).then(async r => {
 | 
			
		||||
    if (r.status >= 400) {
 | 
			
		||||
    if (200 >= r.status < 300) {
 | 
			
		||||
      console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
control_play_pause.addEventListener("click", e => {
 | 
			
		||||
  if (e.target.innerHTML === "⏸︎") {  // pause  // TODO: check is never true
 | 
			
		||||
  if (e.target.innerHTML === "⏵︎") {  // TODO: check is never true
 | 
			
		||||
    fetch(`${API_URL}/pause`).then(async r => {
 | 
			
		||||
      if (r.status >= 400) {
 | 
			
		||||
      if (200 >= r.status < 300) {
 | 
			
		||||
        console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  } else {  // Pause
 | 
			
		||||
    fetch(`${API_URL}/play`).then(async r => {
 | 
			
		||||
      if (r.status >= 400) {
 | 
			
		||||
      if (200 >= r.status < 300) {
 | 
			
		||||
        console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
| 
						 | 
				
			
			@ -154,21 +152,21 @@ control_play_pause.addEventListener("click", e => {
 | 
			
		|||
});
 | 
			
		||||
control_stop.addEventListener("click", e => {
 | 
			
		||||
  fetch(`${API_URL}/stop`).then(async r => {
 | 
			
		||||
    if (r.status >= 400) {
 | 
			
		||||
    if (200 >= r.status < 300) {
 | 
			
		||||
      console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
control_next.addEventListener("click", e => {
 | 
			
		||||
  fetch(`${API_URL}/next_track`).then(async r => {
 | 
			
		||||
    if (r.status >= 400) {
 | 
			
		||||
    if (200 >= r.status < 300) {
 | 
			
		||||
      console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
control_progress.addEventListener("change", e => {
 | 
			
		||||
  fetch(`${API_URL}/seek/${e.target.value}`).then(async r => {
 | 
			
		||||
    if (r.status >= 400) {
 | 
			
		||||
    if (200 >= r.status < 300) {
 | 
			
		||||
      console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
| 
						 | 
				
			
			@ -182,7 +180,7 @@ control_repeat.addEventListener("click", e => {
 | 
			
		|||
    e.target.dataset.state = "on";
 | 
			
		||||
  }
 | 
			
		||||
  fetch(`${API_URL}/repeat`).then(async r => {
 | 
			
		||||
    if (r.status >= 400) {
 | 
			
		||||
    if (200 >= r.status < 300) {
 | 
			
		||||
      console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
| 
						 | 
				
			
			@ -196,7 +194,7 @@ control_shuffle.addEventListener("click", e => {
 | 
			
		|||
    e.target.dataset.state = "on";
 | 
			
		||||
  }
 | 
			
		||||
  fetch(`${API_URL}/random`).then(async r => {
 | 
			
		||||
    if (r.status >= 400) {
 | 
			
		||||
    if (200 >= r.status < 300) {
 | 
			
		||||
      console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
| 
						 | 
				
			
			@ -204,7 +202,7 @@ control_shuffle.addEventListener("click", e => {
 | 
			
		|||
control_xfade_minus.addEventListener("click", e => {
 | 
			
		||||
  // TODO: not yet implemented
 | 
			
		||||
  fetch(`${API_URL}/xfade`).then(async r => {
 | 
			
		||||
    if (r.status >= 400) {
 | 
			
		||||
    if (200 >= r.status < 300) {
 | 
			
		||||
      console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
| 
						 | 
				
			
			@ -212,7 +210,7 @@ control_xfade_minus.addEventListener("click", e => {
 | 
			
		|||
control_xfade_plus.addEventListener("click", e => {
 | 
			
		||||
  // TODO: not yet implemented
 | 
			
		||||
  fetch(`${API_URL}/xfade`).then(async r => {
 | 
			
		||||
    if (r.status >= 400) {
 | 
			
		||||
    if (200 >= r.status < 300) {
 | 
			
		||||
      console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
| 
						 | 
				
			
			@ -220,7 +218,7 @@ control_xfade_plus.addEventListener("click", e => {
 | 
			
		|||
control_volume_up.addEventListener("click", e => {
 | 
			
		||||
  const v = Math.min(parseInt(control_volume.value) + VOLUME_STEP, 100);
 | 
			
		||||
  fetch(`${API_URL}/volume/${v}`).then(async r => {
 | 
			
		||||
    if (r.status >= 400) {
 | 
			
		||||
    if (200 >= r.status < 300) {
 | 
			
		||||
      console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
| 
						 | 
				
			
			@ -230,7 +228,7 @@ control_volume_up.addEventListener("click", e => {
 | 
			
		|||
control_volume_down.addEventListener("click", e => {
 | 
			
		||||
  const v = Math.max(parseInt(control_volume.value) - VOLUME_STEP, 0);
 | 
			
		||||
  fetch(`${API_URL}/volume/${v}`).then(async r => {
 | 
			
		||||
    if (r.status >= 400) {
 | 
			
		||||
    if (200 >= r.status < 300) {
 | 
			
		||||
      console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
| 
						 | 
				
			
			@ -238,7 +236,7 @@ control_volume_down.addEventListener("click", e => {
 | 
			
		|||
});
 | 
			
		||||
control_volume.addEventListener("change", e => {
 | 
			
		||||
  fetch(`${API_URL}/volume/${e.target.value}`).then(async r => {
 | 
			
		||||
    if (r.status >= 400) {
 | 
			
		||||
    if (200 >= r.status < 300) {
 | 
			
		||||
      console.error(`API returned ${r.status}: ${r.statusText}`);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,21 +13,21 @@ function addSongToQueue(song) {
 | 
			
		|||
  length.innerText = song.length;
 | 
			
		||||
  const actions = document.createElement("td");
 | 
			
		||||
  actions.classList.add("actions");
 | 
			
		||||
  // TODO: maybe use `a` instead of `button`?
 | 
			
		||||
  // TODO: maybe use a instead of button?
 | 
			
		||||
  const moveUp = document.createElement("button");
 | 
			
		||||
  moveUp.classList.add("borderless");
 | 
			
		||||
  moveUp.innerHTML = "🔺"; // 🔺 Red Triangle Pointed Down
 | 
			
		||||
  moveUp.addEventListener("click", event => {
 | 
			
		||||
    console.log(`DEBUG: move song ${song.id} up`);
 | 
			
		||||
  });
 | 
			
		||||
  // TODO: maybe use `a` instead of `button`?
 | 
			
		||||
  // TODO: maybe use a instead of button?
 | 
			
		||||
  const moveDown = document.createElement("button");
 | 
			
		||||
  moveDown.classList.add("borderless");
 | 
			
		||||
  moveDown.innerHTML = "$#x1F53B;"; // 🔻 Red Triangle Pointed Up
 | 
			
		||||
  moveDown.addEventListener("click", event => {
 | 
			
		||||
    console.log(`DEBUG: move song ${song.id} down`);
 | 
			
		||||
  });
 | 
			
		||||
  // TODO: maybe use `a` instead of `button`?
 | 
			
		||||
  // TODO: maybe use a instead of button?
 | 
			
		||||
  const remove = document.createElement("button");
 | 
			
		||||
  remove.classList.add("borderless");
 | 
			
		||||
  remove.innerHTML = "$#x274C;"; // ❌ Cross mark; 🗑️ Wastebasket
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue