spectrum element in python

Christian Leichsenring cleichsenring at techfak.uni-bielefeld.de
Tue Aug 18 02:50:18 PDT 2015


I feel a bit stupid monologuing here but I found this relevant bug:
https://bugzilla.gnome.org/show_bug.cgi?id=669982
and would also like to share this ugly one-liner that parses the message
string which seems to be the only solution to use spectrum in Python
before either the Python bindings are fixed or spectrum uses a different
data type. Sorry for the poor indentation. Couldn't figure out how to
disable word wrap in Thunderbird for only one paragraph.

import string
import json
from StringIO import StringIO
def callback(bus, message):
  s = message.get_structure().to_string()
  sep = 'magnitude=(float)'
  data =
json.load(StringIO(s[s.find(sep)+len(sep):].translate(string.maketrans('<>;',
    '[] '))))

Let's all hope that by the time someone finds this code in the archives,
it's no longer needed.

	Christian



More information about the gstreamer-devel mailing list