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

⌈⌋ branch:  streamtuner2


Check-in [2b8f7663be]

Overview
Comment:new RadioSure plugin
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:2b8f7663bed9b0d92ae8b35d3f51c6e679bd025a
User & Date: mario on 2016-04-08 23:09:37
Other Links: manifest | tags
References
2016-04-10
19:52 Fixed ticket [648b0b8041]: RadioSure plus 5 other changes artifact: a85a3b2249 user: mario
Context
2016-04-11
00:53
Group some categories, add description. check-in: 44151e5bce user: mario tags: trunk
2016-04-08
23:09
new RadioSure plugin check-in: 2b8f7663be user: mario tags: trunk
2016-04-07
14:46
New plugin for Reciva check-in: bf85dca133 user: mario tags: trunk
Changes

Added contrib/radiosure.py version [3b8ff7fe4d].























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
102
103
104
105
106
107
# 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
import time
import os.path

# RadioSure "static" radio list
class radiosure (ChannelPlugin):

    # description
    has_search = False
    listformat = "pls"
    audioformat = "audio/mpeg"
    titles = dict(listeners=False, playing="Description")
    zip = "http://www.radiosure.com/rsdbms/stations2.zip"
    tmp = conf.dir + "/cache/radiosure-stations2.zip"

    categories = [
        '-', '50s/60s', '70s/80s', '90s', 'Adult Contemporary', 'Adult Standards / Nostalgia',
        'African', 'All News', 'Americana', 'Arabic', 'Asian', 'Big Band/Swing',
        'Bluegrass', 'Blues', 'Bollywood', 'Children',
        'Choral-Religious', 'Christian', ['Christian-Contemporary',
        'Christian-Gospel', 'Christian-Pop Adult'], 'Classical',
        'College/University', 'Community', 'Country', 'Country-Classic', 'Dance/DJ',
        'Easy Listening', 'Eclectic', 'Electronica', ['Electronica-Ambient',
        'Electronica-Breakbeat', 'Electronica-Chillout', 'Electronica-Dance/DJ',
        'Electronica-Drum & Bass', 'Electronica-Electro',
        'Electronica-Experimental', 'Electronica-Hard House', 'Electronica-House',
        'Electronica-Industrial', 'Electronica-Lounge', 'Electronica-Techno',
        'Electronica-Trance'], 'Fajta', 'Folk', 'Funk', 'Hit Radio - Rock/Top 40',
        'Hits', 'Hits: New and Old', 'Hot Adult Contemporary', 'Independent',
        'Irish/Celtic', 'Islamic', 'Island', 'Island-Caribbean', 'Island-Hawaii',
        'Island-Reggae', 'Island-Reggaeton', 'Jazz', ['Jazz-Classical', 'Jazz-Easy Listening',
        'Jazz-Latin', 'Jazz-Smooth', 'Jazz-Swing'], 'Latin', 'Medieval',
        'Mexican', 'Middle Eastern', 'Musical Comedy', 'Musicals', 'Mystery Shows',
        'New Age', 'Old Time Radio', 'Oldies', 'Opera', 'Pop', 'Public Radio',
        'Rap/Hip Hop', 'Religious-Jewish', 'Religious-Sikhism',
        'Religious-Spiritual', 'Rock', ['Rock-Alternative', 'Rock-Classic',
        'Rock-Goth', 'Rock-Hair Bands', 'Rock-Hard/Metal', 'Rock-Heavy Metal',
        'Rock-Indie', 'Rock-Pop', 'Rock-Progressive', 'Rock-Punk',
        'Rock-Rockabilly'], 'Seasonal', 'Seasonal-Christmas', 'Seasonal-Halloween',
        'Soft Adult Contemporary', 'Soul/R&B', 'Soundtracks', 'Spanish', 'Talk',
        ['Talk-Business', 'Talk-Comedy', 'Talk-Government', 'Talk-News',
        'Talk-Progressive', 'Talk-Public Radio', 'Talk-Religious', 'Talk-Sports',
        'Talk-Weather'], 'Tejano', 'Tropical', 'University', 'Urban Contemporary',
        'Variety', 'Western', 'World/Folk'
    ]

    # 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]