From 87b803918dd7a17f5caad55d7de9fd58f3614370 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 19 May 2014 14:09:35 +0200 Subject: [PATCH] Put list_processors in core, update dive in and install docs --- doc/source/dev.rst | 2 +- doc/source/dive_in.rst | 31 ++++++++++++++++++++++++------- doc/source/install.rst | 2 +- doc/source/intro.rst | 2 +- tests/get_samples.py | 6 ------ tests/listprocessors.py | 13 ------------- tests/unit_timeside.py | 2 ++ timeside/core.py | 10 ++++++++++ 8 files changed, 39 insertions(+), 29 deletions(-) delete mode 100644 tests/get_samples.py delete mode 100644 tests/listprocessors.py diff --git a/doc/source/dev.rst b/doc/source/dev.rst index ab6cb20..72ad146 100644 --- a/doc/source/dev.rst +++ b/doc/source/dev.rst @@ -1,7 +1,7 @@ Development =========== -For versions >=0.5 on Debian Stable 7.0 Wheezy: +For versions >=0.5 on Debian 7 Wheezy: .. code-block:: bash diff --git a/doc/source/dive_in.rst b/doc/source/dive_in.rst index 87be35f..ee110b3 100644 --- a/doc/source/dive_in.rst +++ b/doc/source/dive_in.rst @@ -1,22 +1,39 @@ Dive in ======== -Define some processors:: +To list all available plugins:: >>> import timeside - >>> decoder = timeside.decoder.file.FileDecoder('sweep.wav') - >>> grapher = timeside.grapher.waveform_simple.Waveform() - >>> analyzer = timeside.analyzer.level.Level() - >>> encoder = timeside.encoder.ogg.VorbisEncoder('sweep.ogg') + >>> timeside.core.list_processors() + +Define some processors:: + + >>> from timeside.core import get_processor + >>> decoder = get_processor('gst_dec')('sweep.wav') + >>> grapher = get_processor('waveform_simple') + >>> analyzer = get_processor('level') + >>> encoder = get_processor('gst_vorbis_enc')('sweep.ogg') -then, the *magic* pipeline:: +Then run the *magic* pipeline:: >>> (decoder | grapher | analyzer | encoder).run() -get the results:: +Render the grapher results:: >>> grapher.render(output='waveform.png') + +Show the analyzer results:: + >>> print 'Level:', analyzer.results +The encoded OGG file should also be there... + +Note you can also instanciate each processor with its own class:: + + >>> decoder = timeside.decoder.file.FileDecoder('sweep.wav') + >>> grapher = timeside.grapher.waveform_simple.Waveform() + >>> analyzer = timeside.analyzer.level.Level() + >>> encoder = timeside.encoder.ogg.VorbisEncoder('sweep.ogg') + For more extensive examples, please see the `http://files.parisson.com/timeside/doc/ `_. diff --git a/doc/source/install.rst b/doc/source/install.rst index 0dadda1..ab4bc78 100644 --- a/doc/source/install.rst +++ b/doc/source/install.rst @@ -25,7 +25,7 @@ Note you can also use pip if you already have already satisfied all the dependen Other Linux distributions -------------------------- -On other Linux platforms, you need to install all dependencies listed in the paragraph named "Dependencies" (find all equivalent package names for your distribution). +On other Linux platforms, you need to install all dependencies listed in the paragraph #Dependencies (find all equivalent package names for your distribution). Then, use pip:: diff --git a/doc/source/intro.rst b/doc/source/intro.rst index caf156b..a282251 100644 --- a/doc/source/intro.rst +++ b/doc/source/intro.rst @@ -2,7 +2,7 @@ TimeSide : open web audio processing framework ============================================== -TimeSide is a set of python components enabling low and high level audio analysis, imaging, transcoding and streaming. Its high-level API is designed to enable complex processing on large datasets of audio and video assets of any format. Its simple plug-in architecture can be adapted to various use cases. +TimeSide is a set of python components enabling low and high level audio analysis, imaging, transcoding and streaming. Its high-level API is designed to enable complex processing on large datasets of audio and video assets of any format. Its simple plug-in architecture can be adapted to various use cases. TimeSide also includes a smart interactive HTML5 player which provides various streaming playback functions, formats selectors, fancy audio visualizations, segmentation and semantic labelling synchronized with audio events. It is embeddable in any web application. diff --git a/tests/get_samples.py b/tests/get_samples.py deleted file mode 100644 index a4d37a8..0000000 --- a/tests/get_samples.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from tools import check_samples - -check_samples() diff --git a/tests/listprocessors.py b/tests/listprocessors.py deleted file mode 100644 index aa37896..0000000 --- a/tests/listprocessors.py +++ /dev/null @@ -1,13 +0,0 @@ -import timeside -import timeside.core - -def list_processors(interface, prefix=""): - print prefix + interface.__name__ - subinterfaces = interface.__subclasses__() - for i in subinterfaces: - list_processors(i, prefix + " ") - processors = timeside.core.processors(interface, False) - for p in processors: - print prefix + " %s [%s]" % (p.__name__, p.id()) - -list_processors(timeside.api.IProcessor) diff --git a/tests/unit_timeside.py b/tests/unit_timeside.py index dad1bf4..0e5789d 100644 --- a/tests/unit_timeside.py +++ b/tests/unit_timeside.py @@ -6,6 +6,8 @@ import sys import time from tools import check_samples +check_samples() + class _TextTestResult(unittest.TestResult): """A test result class that can print formatted text results to a stream. diff --git a/timeside/core.py b/timeside/core.py index b40920c..d821225 100644 --- a/timeside/core.py +++ b/timeside/core.py @@ -235,6 +235,16 @@ def get_processor(processor_id): return _processors[processor_id] +def list_processors(interface=IProcessor, prefix=""): + print prefix + interface.__name__ + subinterfaces = interface.__subclasses__() + for i in subinterfaces: + list_processors(interface=i, prefix=prefix + " ") + procs = processors(interface, False) + for p in procs: + print prefix + " %s [%s]" % (p.__name__, p.id()) + + class ProcessPipe(object): """Handle a pipe of processors -- 2.39.5