ordigi/dozo/media/audio.py

37 lines
877 B
Python
Raw Normal View History

"""
2016-01-08 23:49:06 +01:00
The audio module contains classes specifically for dealing with audio files.
The :class:`Audio` class inherits from the :class:`~dozo.media.Media`
2016-01-08 23:49:06 +01:00
class.
.. moduleauthor:: Jaisen Mathai <jaisen@jmathai.com>
"""
2021-06-27 07:18:35 +02:00
import os
2021-06-20 19:51:21 +02:00
from .media import Media
2021-06-20 19:51:21 +02:00
class Audio(Media):
2016-01-08 23:49:06 +01:00
"""An audio object.
:param str source: The fully qualified path to the audio file.
"""
__name__ = 'Audio'
2016-01-08 23:49:06 +01:00
#: Valid extensions for audio files.
extensions = ('m4a',)
2021-07-17 16:47:31 +02:00
def __init__(self, source=None, ignore_tags=set()):
super().__init__(source, ignore_tags=set())
2021-06-20 19:51:21 +02:00
def is_valid(self):
2021-06-27 07:18:35 +02:00
"""Check the file extension against valid file extensions.
The list of valid file extensions come from self.extensions.
:returns: bool
"""
source = self.source
return os.path.splitext(source)[1][1:].lower() in self.extensions