]> git.parisson.com Git - timeside.git/commitdiff
add a UUID based on a 32 bit hash for each processor
authorGuillaume Pellerin <yomguy@parisson.com>
Thu, 31 Oct 2013 09:14:37 +0000 (10:14 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Thu, 31 Oct 2013 09:14:37 +0000 (10:14 +0100)
timeside/api.py
timeside/core.py
timeside/grapher/waveform_transparent.py

index ad2b3748a1eaf43013c7006af84ecf0294ee28ac..8f53cd4f3af40c034c9035438ad390d1b61242a4 100644 (file)
@@ -96,6 +96,11 @@ class IProcessor(Interface):
         duration
         """
 
+    @staticmethod
+    def uuid():
+        """Return the UUID of the processor"""
+
+
 class IEncoder(IProcessor):
     """Encoder driver interface. Each encoder is expected to support a specific
     format."""
index 06323cbbd95dbf7b4232251ba49555404e5969a5..d477ca459ae6fc81ea47a38f03ea2d95acd1bb56 100644 (file)
@@ -24,6 +24,7 @@ from timeside.exceptions import Error, ApiError
 import re
 import time
 import numpy
+import random
 
 __all__ = ['Processor', 'MetaProcessor', 'implements', 'abstract',
            'interfacedoc', 'processors', 'get_processor', 'ProcessPipe',
@@ -68,6 +69,9 @@ class Processor(Component):
     abstract()
     implements(IProcessor)
 
+    def __init__(self):
+        self.UUID = "%08x" % random.getrandbits(32)
+
     @interfacedoc
     def setup(self, channels=None, samplerate=None, blocksize=None,
               totalframes=None):
@@ -123,6 +127,10 @@ class Processor(Component):
     def mediainfo(self):
         return self.source_mediainfo
 
+    @interfacedoc
+    def uuid(self):
+        return self.UUID
+
     def __del__(self):
         self.release()
 
index 3fd21a3bf339dc0c326293f937483fb5f8a1de96..0e5b246c5bc1f84139ea2b60a345abff136b4f0b 100644 (file)
@@ -24,6 +24,7 @@ from timeside.api import IGrapher
 from timeside.grapher.core import *
 from timeside.grapher.waveform_simple import Waveform
 
+
 class WaveformTransparent(Waveform):
     """ Builds a PIL image representing a waveform of the audio stream.
     Adds pixels iteratively thanks to the adapter providing fixed size frame buffers.