Index: config.py ================================================================== --- config.py +++ config.py @@ -123,11 +123,11 @@ # store some configuration list/dict into a file def save(self, name="settings", data=None, gz=0, nice=0): name = name + ".json" - if (data == None): + if (data is None): data = dict(self.__dict__) # ANOTHER WORKAROUND: typecast to plain dict(), else json filter_data sees it as object and str()s it nice = 1 # check for subdir if (name.find("/") > 0): subdir = name[0:name.find("/")] @@ -154,21 +154,21 @@ name = name + ".json" file = self.dir + "/" + name try: # .gz or normal file if os.path.exists(file + ".gz"): - f = gzip.open(file + ".gz", "r") + f = gzip.open(file + ".gz", "rt") elif os.path.exists(file): - f = open(file, "r") + f = open(file, "rt") else: return # file not found # decode r = json.load(f) f.close() return r except Exception as e: - print("PSON parsing error (in "+name+")", e) + print(dbg.ERR, "PSON parsing error (in "+name+")", e) # recursive dict update def update(self, with_new_data): for key,value in with_new_data.items(): Index: st2.py ================================================================== --- st2.py +++ st2.py @@ -30,24 +30,17 @@ """ project status """ # # The application runs mostly stable. The GUI interfaces are workable. +# It's supposed to run on Gtk2 and Gtk3. Python3 support is still WIP. # There haven't been any optimizations regarding memory usage and -# performance. The current internal API is acceptable. Documentation is -# coming up. +# performance. The current internal API is vastly undocumented. # # current bugs: # - audio- and list-format support is not very robust / needs better API -# - lots of GtkWarning messages # - not all keyboard shortcuts work -# - in-list search doesn't work in our treeviews (???) -# - JSON files are only trouble: loading of data files might lead to more -# errors now, even if pson module still falls back on old method -# (unicode strings from json.load are useless to us, require typecasts) -# (nonsupport of tuples led to regression in mygtk.app_restore) -# (sometimes we receive 8bit-content, which the json module can't save) # # features: # - treeview lists are created from datamap[] structure and stream{} dicts # - channel categories are built-in defaults (can be freshened up however) # - config vars and cache data get stored as JSON in ~/.config/streamtuner2/ @@ -66,15 +59,10 @@ # as they are passed to gtk.gdk.Pixbuf (OTOH data pre-filtered by Google) # - MEDIUM: audio players / decoders are easily affected by buffer overflows # from corrupt mp3/stream data, and streamtuner2 executes them # - but since that's the purpose -> no workaround # -# still help wanted on: -# - any of the above -# - new plugins (local file viewer) -# - nicer logo (or donations accepted to consult graphics designer) -# # standard modules import sys