Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ branch:  streamtuner2


Diff

Differences From Artifact [530431fbe1]:

To Artifact [e9222413a9]:


54
55
56
57
58
59
60

61
62
63
64
65
66
67
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68







+






        listformat = "audio/x-scpls"
        audioformat = "audio/mpeg" # fallback value
        config = []
        has_search = False

        # categories
        categories = ["empty", ]
        catmap = {}
        current = ""
        default = "empty"
        shown = None     # last selected entry in stream list, also indicator if notebook tab has been selected once / stream list of current category been displayed yet

        # gui + data
        streams = {}      #meta information dicts
        liststore = {}    #gtk data structure
129
130
131
132
133
134
135




136
137
138
139
140
141
142
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147







+
+
+
+






            cache = conf.load("cache/" + self.module)
            if (cache):
                self.streams = cache
            # categories
            cache = conf.load("cache/categories_" + self.module)
            if (cache):
                self.categories = cache
            # catmap (optional)
            cache = conf.load("cache/catmap_" + self.module)
            if (cache):
                self.catmap = cache
            pass

            
        # initialize Gtk widgets / data objects
        def gui(self, parent):
            #print(self.module + ".gui()")
372
373
374
375
376
377
378

379



380
381
382
383
384
385
386
377
378
379
380
381
382
383
384

385
386
387
388
389
390
391
392
393
394







+
-
+
+
+








        # update categories, save, and display                
        def reload_categories(self):
        
            # get data and save
            self.update_categories()
            if self.categories:
            conf.save("cache/categories_"+self.module, self.categories)
                conf.save("cache/categories_"+self.module, self.categories)
            if self.catmap:
                conf.save("cache/catmap_" + self.module, self.catmap);

            # display outside of this non-main thread            
            mygtk.do(self.display_categories)

        # insert content into gtk category list
        def display_categories(self):
        
460
461
462
463
464
465
466





467
468
469
470
471
472
473
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486







+
+
+
+
+






        # remove SGML/XML entities
        def entity_decode(self, s):
            return xml.sax.saxutils.unescape(s)
        
        # convert special characters to &xx; escapes
        def xmlentities(self, s):
            return xml.sax.saxutils.escape(s)
        
        # Extracts integer from string
        def to_int(self, s):
            i = re.findall("\d+", s) or [0]
            return int(i[0])