Got shitty basic features working.

This commit is contained in:
The Wobbler 2024-12-21 19:00:06 +01:00
parent ce254c8b54
commit 45d97f5aeb
6 changed files with 97 additions and 29 deletions

View file

@ -14,7 +14,7 @@ class Track:
self.path = path
self.cached = cache
self.sound = self.cache() if self.cached else None
(self.audio, self.sound, self.duration) = self.cache() if self.cached else (None, None, 0)
def cache(self):
audio = AudioSegment.from_mp3(self.path)
@ -24,6 +24,8 @@ class Track:
sound = Sound(wav)
# audio_bytes = io.BytesIO(wav.read())
# return pygame.mixer.Sound object and track duration in milliseconds
return audio, sound, len(audio)
return sound
def remaining(self, position: int):
return self.audio[-position:]