2016-01-04 07:10:56 +01:00
|
|
|
"""
|
2016-01-08 23:49:06 +01:00
|
|
|
The audio module contains classes specifically for dealing with audio files.
|
2021-07-30 07:41:02 +02:00
|
|
|
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>
|
2016-01-04 07:10:56 +01:00
|
|
|
"""
|
|
|
|
|
2021-06-27 07:18:35 +02:00
|
|
|
import os
|
2021-06-20 19:51:21 +02:00
|
|
|
from .media import Media
|
2016-01-04 07:10:56 +01:00
|
|
|
|
|
|
|
|
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.
|
|
|
|
"""
|
|
|
|
|
2016-01-04 07:10:56 +01:00
|
|
|
__name__ = 'Audio'
|
2016-01-08 23:49:06 +01:00
|
|
|
|
|
|
|
#: Valid extensions for audio files.
|
2016-01-08 02:10:55 +01:00
|
|
|
extensions = ('m4a',)
|
2016-01-04 07:10:56 +01:00
|
|
|
|
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
|