Index: pluginconf.py ================================================================== --- pluginconf.py +++ pluginconf.py @@ -2,11 +2,11 @@ # api: python # type: handler # category: io # title: Plugin configuration # description: Read meta data, pyz/package contents, module locating -# version: 0.6 +# version: 0.6.2 # priority: core # docs: http://fossil.include-once.org/streamtuner2/wiki/plugin+meta+data # config: - # # Provides plugin lookup and meta data extraction utility functions. @@ -236,10 +236,11 @@ "config": [], "doc": "" } # Extract coherent comment block + src = src.replace("\r", "") if not literal: src = rx.comment.search(src) if not src: log_ERR("Couldn't read source meta information:", fn) return meta @@ -291,11 +292,11 @@ # well enough already. Technically a YAML parser would # do better; but is likely overkill. # class rx: comment = re.compile(r"""(^ {0,4}#.*\n)+""", re.M) - hash = re.compile(r"""(^ {0,4}# *)""", re.M) + hash = re.compile(r"""(^ {0,4}# *\r*)""", re.M) keyval = re.compile(r""" ^([\w-]+):(.*$(?:\n(?![\w-]+:).+$)*) # plain key:value lines """, re.M | re.X) config = re.compile(r""" \{ (.+?) \} | \< (.+?) \> # JSOL/YAML scheme {...} dicts Index: uikit.py ================================================================== --- uikit.py +++ uikit.py @@ -30,11 +30,10 @@ import re import base64 import inspect from compat2and3 import unicode, xrange, PY3, gzip_decode - # gtk version (2=gtk2, 3=gtk3, 7=tk;) ver = 2 # if running on Python3 or with commandline flag if PY3 or conf.args.gtk3: ver = 3 @@ -51,10 +50,11 @@ else: import pygtk import gtk import gobject GdkPixbuf = gtk.gdk +empty_pixbuf = None # prepare gtkbuilder data ui_xml = get_data("gtk3.xml.gz", decode=True, gz=True) #or get_data("gtk3.xml", decode=True) if ver == 2: ui_xml = ui_xml.replace('version="3.0"', 'version="2.16"') @@ -615,12 +615,16 @@ p = GdkPixbuf.PixbufLoader.new_with_type(fmt) elif fmt: p = GdkPixbuf.PixbufLoader(fmt) else: p = GdkPixbuf.PixbufLoader() - if decode and re.match("^[\w+/=\s]+$", str(buf)): - buf = base64.b64decode(buf) # inline encoding + if decode: # inline encoding + if re.match("^[\w+/=\s]+$", str(buf)): + buf = base64.b64decode(buf) # from e.g. #png: meta field + else: + p.close() + return empty_pixbuf if gzip: buf = gzip_decode(buf) if buf: p.write(buf) pix = p.get_pixbuf()