Completely removed supported formats check because Pydub is compatible with almost every format.
This commit is contained in:
parent
b77df6987c
commit
ed92c46f95
1 changed files with 2 additions and 13 deletions
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
from pydub import AudioSegment
|
from pydub import AudioSegment
|
||||||
from pydub.effects import normalize
|
|
||||||
from pygame.mixer import Sound
|
from pygame.mixer import Sound
|
||||||
from tinytag import TinyTag
|
from tinytag import TinyTag
|
||||||
|
|
||||||
|
|
||||||
SUPPORTED_FORMATS = [
|
|
||||||
"mp3",
|
|
||||||
"wav",
|
|
||||||
"ogg",
|
|
||||||
"flac",
|
|
||||||
"m4a"
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class Track:
|
class Track:
|
||||||
"""
|
"""
|
||||||
Class containing data for a track like file path, raw data...
|
Class containing data for a track like file path, raw data...
|
||||||
|
@ -86,9 +76,8 @@ class Track:
|
||||||
self.duration = 0
|
self.duration = 0
|
||||||
|
|
||||||
def load_audio(self):
|
def load_audio(self):
|
||||||
file_type = self.path.split(".")[-1]
|
#file_type = self.path.split(".")[-1]
|
||||||
|
|
||||||
if file_type in SUPPORTED_FORMATS:
|
|
||||||
self.audio = AudioSegment.from_file(self.path)
|
self.audio = AudioSegment.from_file(self.path)
|
||||||
|
|
||||||
def remaining(self, position: int):
|
def remaining(self, position: int):
|
||||||
|
|
Loading…
Add table
Reference in a new issue