From: Guillaume Pellerin Date: Thu, 31 Oct 2013 21:30:58 +0000 (+0100) Subject: modify parent immplementation, unstable X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=61f5b94b03fd2f8c4491b0a96c85eae1039f8dc5;p=timeside.git modify parent immplementation, unstable --- diff --git a/timeside/analyzer/odf.py b/timeside/analyzer/odf.py index 06c91ae..f99a4a4 100644 --- a/timeside/analyzer/odf.py +++ b/timeside/analyzer/odf.py @@ -40,8 +40,11 @@ class OnsetDetectionFunction(Analyzer): else: self.input_stepsize = blocksize / 2 - self.parents.append(Spectrogram(blocksize=self.input_blocksize, - stepsize=self.input_stepsize)) + @staticmethod + @interfacedoc + def parents(self): + return list(Spectrogram(blocksize=self.input_blocksize, + stepsize=self.input_stepsize)) @interfacedoc def setup(self, channels=None, samplerate=None, diff --git a/timeside/api.py b/timeside/api.py index b6eeb78..17d6e38 100644 --- a/timeside/api.py +++ b/timeside/api.py @@ -100,6 +100,10 @@ class IProcessor(Interface): def uuid(): """Return the UUID of the processor""" + @staticmethod + def parents(self): + """Return the parent processor list of the processor""" + class IEncoder(IProcessor): """Encoder driver interface. Each encoder is expected to support a specific diff --git a/timeside/core.py b/timeside/core.py index b88bcea..254622a 100644 --- a/timeside/core.py +++ b/timeside/core.py @@ -82,7 +82,11 @@ class Processor(Component): self.parents = [] self.source_mediainfo = None self.pipe = None - self.UUID = "%08x" % random.getrandbits(32) + self._uuid = "%08x" % random.getrandbits(32) + + interfacedoc + def parents(self): + pass @interfacedoc def setup(self, channels=None, samplerate=None, blocksize=None, @@ -103,7 +107,6 @@ class Processor(Component): if not hasattr(self, 'input_stepsize'): self.input_stepsize = self.source_blocksize - # default channels(), samplerate() and blocksize() implementations returns # the source characteristics, but processors may change this behaviour by # overloading those methods @@ -141,7 +144,7 @@ class Processor(Component): @interfacedoc def uuid(self): - return self.UUID + return self._uuid def __del__(self): self.release() @@ -253,6 +256,7 @@ class ProcessPipe(object): def __ior__(self, other): if isinstance(other, Processor): self |= other.parents + print self self.processors.append(other) elif isinstance(other, ProcessPipe): self.processors.extend(other.processors)