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

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [3b8ff7fe4d]:

To Artifact [c4096229db]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# encoding: UTF-8
# api: streamtuner2
# title: RadioSure
# description: Huge radio station collection
# version: 0.2
# type: channel
# category: radio
# url: http://radiosure.com/
# config: -
# priority: extra
# png: 
#   iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEULDgpKTEmQko/19/S0inLcAAAAUklEQVQI12P4DwQMDvuBBIs92zcGHh2G
#   BQw+FvUPGDwq/n9gaPoj/5DB6b/TQwaH/18uMrjs/yPI4FP2R4kh1vBHPUO8SsAnBn8P9ocMYFNABADRrSa61FmXoAAAAABJRU5ErkJggg==
#
# RadioSure is a Windows freeware/shareware for playing internet
# stations. It comes with a huge database of streams.
#
# Fetches the ZIP/CSV at once. Extracts all stations in memory.
# RadioSure stream lists are just updated once per day.
#


from config import *
from channels import *
import re
import ahttp
import zipfile




|












|
|
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
# encoding: UTF-8
# api: streamtuner2
# title: RadioSure
# description: Huge radio station collection
# version: 0.3
# type: channel
# category: radio
# url: http://radiosure.com/
# config: -
# priority: extra
# png: 
#   iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEULDgpKTEmQko/19/S0inLcAAAAUklEQVQI12P4DwQMDvuBBIs92zcGHh2G
#   BQw+FvUPGDwq/n9gaPoj/5DB6b/TQwaH/18uMrjs/yPI4FP2R4kh1vBHPUO8SsAnBn8P9ocMYFNABADRrSa61FmXoAAAAABJRU5ErkJggg==
#
# RadioSure is a Windows freeware/shareware for playing internet
# stations. It comes with a huge database of streams.
#
# Fetches and keeps the ZIP/CSV database at maximum once per day.
# (Not updated more frequently.)



from config import *
from channels import *
import re
import ahttp
import zipfile
73
74
75
76
77
78
79

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
    # categories are derived from the station list
    def update_categories(self):
        #self.categories = sorted(self.streams.keys())
        pass

    # import station list
    def update_streams(self, cat, search=None):

        # refresh zip file
        if not os.path.isfile(self.tmp) or os.path.getmtime(self.tmp) < (time.time() - 3600):
            with open(self.tmp, "w") as f:
                f.write(ahttp.get(self.zip, binary=1))
        # get first file
        zip = zipfile.ZipFile(self.tmp)
        csv = zip.read(zip.namelist()[0])
        self.status("Updating streams from RadioSure CSV database")
        #fields = ["title", "playing", "genre", "country", "language", "url"]
        for e in re.findall("^([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+(?:\t[^\t]{3,})*)", csv, re.M):
            genre = e[2]
            if not genre in self.streams:
                self.streams[genre] = []
            self.streams[genre].append(dict(
                title = e[0],
                playing = e[1],
                genre = e[2],
                country = e[3],
                language = e[4],
                url = e[5]#...
            ))
        return self.streams[cat]
        
        
        
        
        
        







>

|






|

|
<
<
|
|
|
|
|
|
|
|
|
|
|
<
<
<
<
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90


91
92
93
94
95
96
97
98
99
100
101




    # categories are derived from the station list
    def update_categories(self):
        #self.categories = sorted(self.streams.keys())
        pass

    # import station list
    def update_streams(self, cat, search=None):
        streams = []
        # refresh zip file
        if not os.path.isfile(self.tmp) or os.path.getmtime(self.tmp) < (time.time() - 24*3600):
            with open(self.tmp, "w") as f:
                f.write(ahttp.get(self.zip, binary=1))
        # get first file
        zip = zipfile.ZipFile(self.tmp)
        csv = zip.read(zip.namelist()[0])
        self.status("Updating streams from RadioSure CSV database")
        # fields = ["title", "playing", "genre", "country", "language", "url"]
        for e in re.findall("^([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+(?:\t[^\t]{3,})*)", csv, re.M):
            if cat == e[2]:


                streams.append(dict(
                    title = e[0],
                    playing = e[1],
                    genre = e[2],
                    country = e[3],
                    language = e[4],
                    url = e[5]#...
                ))
        return streams