diff --git a/app/settings.py b/app/settings.py index 9289b007..60e1e31a 100644 --- a/app/settings.py +++ b/app/settings.py @@ -270,3 +270,4 @@ EMAIL_HOST = '134.158.33.163' EMAIL_SUBJECT_PREFIX = '[TimeSide]' +TIMESIDE_DEFAULT_DECODER = 'aubio_decoder' \ No newline at end of file diff --git a/timeside/plugins/analyzer/externals/aubio_pitch.py b/timeside/plugins/analyzer/externals/aubio_pitch.py index d6de1f15..ffe31410 100644 --- a/timeside/plugins/analyzer/externals/aubio_pitch.py +++ b/timeside/plugins/analyzer/externals/aubio_pitch.py @@ -104,7 +104,7 @@ def name(): @staticmethod @interfacedoc def version(): - return "0.4.7" + return "0.4.6" @staticmethod @interfacedoc diff --git a/timeside/plugins/decoder/aubio.py b/timeside/plugins/decoder/aubio.py index 2e22b9dc..7ac4f2ee 100644 --- a/timeside/plugins/decoder/aubio.py +++ b/timeside/plugins/decoder/aubio.py @@ -3,7 +3,7 @@ """ decoder plugin based on aubio """ from timeside.core.decoder import Decoder, IDecoder, implements, interfacedoc -from timeside.plugins.decoder.utils import get_sha1 +from timeside.plugins.decoder.utils import get_sha1, get_media_uri_info import aubio import mimetypes diff --git a/timeside/plugins/decoder/file.py b/timeside/plugins/decoder/file.py index 80073152..988711d2 100644 --- a/timeside/plugins/decoder/file.py +++ b/timeside/plugins/decoder/file.py @@ -107,6 +107,7 @@ def __init__(self, uri, start=0, duration=None, stack=False, sha1=None): self._sha1 = sha1.encode('utf8') self.uri_total_duration = get_media_uri_info(self.uri)['duration'] + self.uri_duration = self.uri_total_duration self.mimetype = None diff --git a/timeside/server/models.py b/timeside/server/models.py index ca8a14de..8678b447 100644 --- a/timeside/server/models.py +++ b/timeside/server/models.py @@ -118,6 +118,9 @@ def get_processor_pids(): os.makedirs(RESULTS_ROOT) +DEFAULT_DECODER = getattr(settings, 'TIMESIDE_DEFAULT_DECODER', 'file_decoder') + + class UUIDEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, UUID): @@ -408,9 +411,9 @@ def get_audio_duration(self, force=False): Return item audio duration """ if (force or not self.audio_duration) and self.source_file: - decoder = timeside.core.get_processor('file_decoder')( + decoder = timeside.core.get_processor(DEFAULT_DECODER)( uri=self.get_uri()) - self.audio_duration = decoder.uri_total_duration + self.audio_duration = decoder.uri_duration super(Item, self).save() def get_hash(self, force=False): @@ -455,8 +458,14 @@ def run(self, experience): uri = self.get_uri() # decode audio source - decoder = timeside.plugins.decoder.file.FileDecoder(uri=uri, + # TODO: use get_processor + if DEFAULT_DECODER == 'aubio_decoder': + decoder = timeside.plugins.decoder.aubio.AubioDecoder(uri=uri, sha1=self.sha1) + else: + decoder = timeside.plugins.decoder.file.FileDecoder(uri=uri, + sha1=self.sha1) + presets = {} pipe = decoder parent_analyzers = []