diff --git a/index.html b/index.html
new file mode 100644
index 0000000..0e4e05b
--- /dev/null
+++ b/index.html
@@ -0,0 +1,148 @@
+
+
+
+
+ Music Player
+
+
+
+
+
🎵 Dashdio
+
+
Artist: -
+
Title: -
+
Status: -
+
+
+
+
+
+
+
+
+
+
+
+
📃 Queue
+
+
+
+
+
+ # |
+ Artist |
+ Title |
+ Duration |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/interface.html b/interface.html
deleted file mode 100644
index a5c0888..0000000
--- a/interface.html
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
-
-
- Music Player
-
-
-
- Music Player
-
-
-
Player Controls
-
-
-
-
-
-
-
Volume
-
- 0
-
-
-
-
Queue
-
-
-
-
-
-
-
-
-
-
-
diff --git a/main.py b/main.py
index c61b874..33ea8b3 100644
--- a/main.py
+++ b/main.py
@@ -71,7 +71,7 @@ ws_manager = ConnectionManager()
# Interface
@app.get("/", response_class=HTMLResponse)
async def root():
- with open("interface.html") as f:
+ with open("index.html") as f:
return f.read()
diff --git a/music_player.py b/music_player.py
index cf8ab30..2376b90 100644
--- a/music_player.py
+++ b/music_player.py
@@ -1,4 +1,5 @@
import asyncio
+import os
import threading
import time
from enum import Enum
@@ -82,7 +83,7 @@ class MusicPlayer:
async def _update_position(self):
new_pos = pygame.mixer.music.get_pos() // 1000
- # Changes only of fulls seconds
+ # Changes only on fulls seconds
if new_pos != self._state.position:
if new_pos == -1:
self._state.position = None
@@ -104,9 +105,16 @@ class MusicPlayer:
async def _handle_track_finished(self) -> None:
print(f"Finished playing {self._state.track}")
- await self._set_track(None)
+ await self._unload_track()
await self._set_playback_state(PlaybackState.Stopped)
+ async def _unload_track(self) -> None:
+ pygame.mixer.music.unload()
+ # Delete file from disc
+ os.remove(self._state.track.filepath)
+ # Update state
+ await self._set_track(None)
+
async def _load_track(self, track: Track):
await self._set_track(track)
pygame.mixer.music.unload()