forked from Wobbl/Wobuzz
Got shitty basic features working.
This commit is contained in:
parent
ce254c8b54
commit
45d97f5aeb
6 changed files with 97 additions and 29 deletions
|
@ -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:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue