Check-in [493be36226]
Comment: | Exchanged all "import ahttp as http" for plain `ahttp` module usage. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
493be362260d1bbc184604e10c0732ef |
User & Date: | mario on 2015-04-29 22:55:24 |
Other Links: | manifest | tags |
2015-04-29
| ||
22:59 | Undo itertools.chain(), use plain list appending. check-in: 051366205f user: mario tags: trunk | |
22:55 | Exchanged all "import ahttp as http" for plain `ahttp` module usage. check-in: 493be36226 user: mario tags: trunk | |
22:54 | PublicRadioFan directory plugin. (Works ok, but fetching is somewhat slow.) check-in: 747be98229 user: mario tags: trunk | |
Modified channels/__init__.py from [162b9d0f3b] to [3d68982aa3].
︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | - + | # GtkBuilder description. They derive from ChannelPlugins therefore, # which constructs and registers the required gtk widgets manually. import gtk from uikit import uikit, ver as gtk_ver from config import * |
︙ | |||
394 395 396 397 398 399 400 | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | - + | # deduce homepage URLs from title # by looking for www.xyz.com domain names if not row.get("homepage"): url = self.rx_www_url.search(row.get("title", "")) if url: url = url.group(0).lower().replace(" ", "") url = (url if url.find("www.") == 0 else "www."+url) |
︙ |
Modified channels/icast.py from [84d1b6b174] to [2c4e5b4f8f].
︙ | |||
33 34 35 36 37 38 39 | 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 | - + - + - + | # collect 200 station entries (see main options). import re import json from config import * from channels import * |
︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | - + | return r # fetch multiple pages def api(self, method, path, params): r = [] while len(r) < int(conf.max_streams): |
Modified channels/internet_radio.py from [7d08db49a9] to [738c122eb2].
︙ | |||
25 26 27 28 29 30 31 | 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 | - + - + | # setting, rather than the global max_streams option. # from channels import * import re from config import * |
︙ | |||
67 68 69 70 71 72 73 | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | - + | # Fetch multiple pages at once html = [] max_pages = max(int(conf.internetradio_max_pages), 1) for page in range(1, max_pages): # Append HTML source html.append( |
︙ | |||
124 125 126 127 128 129 130 | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | - + | if uu: (url, title, playing, homepage, genres, listeners, bitrate) = uu.groups() # transform data r.append({ "url": url, "genre": self.strip_tags(genres or ""), |
︙ | |||
163 164 165 166 167 168 169 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | - + | else: url = "" else: url = "" r.append({ "title": dir.find("h4").text(), |
Modified channels/itunes.py from [43771b8835] to [7f3b7c5cee].
︙ | |||
30 31 32 33 34 35 36 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - + | # # In this module only iTunes will be queried for now. # import re from config import * from channels import * |
︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | - + | # static list for iTunes def update_categories(self): pass # Just copy over stream URLs and station titles def update_streams(self, cat): |
︙ |
Modified channels/jamendo.py from [e32838ce56] to [7a2d2e43d6].
︙ | |||
33 34 35 36 37 38 39 | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - + | # Per default Ogg Vorbis is used as streaming format. Track URLs can be played # back directly. Playlists and albums now require a roundtrip over the action # module to extract the JAMJson format into pls/m3u/xspf. (The previous v2 API # retrieval is going to become inaccessible soon.) import re |
︙ | |||
375 376 377 378 379 380 381 | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | - + | "audioformat": "mp32", "imagesize": conf.jamendo_image_size, "offset": 0, "limit": 200, }.items()) + list(params.items()) ) while (params["offset"] < max) and (len(r) % 200 == 0): |
︙ |
Modified channels/live365.py from [43a955e299] to [73c3b74f30].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - + - + - | # # Live365 lists around 5000 radio stations. Some are paid # entries and require a logon. This plugins tries to filter # thoise out. # streamtuner2 modules |
︙ | |||
86 87 88 89 90 91 92 | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | - + | # extract stream infos def update_streams(self, cat): # Retrieve genere index pages html = "" for i in [1, 17, 33, 49]: url = "http://www.live365.com/cgi-bin/directory.cgi?first=%i&site=web&mode=3&genre=%s&charset=UTF-8&target=content" % (i, cat.lower()) |
︙ |
Modified channels/modarchive.py from [e1c513f5b2] to [932f509dd8].
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | - + | # # Configuring VLC for `audio/mod+zip` or just a generic `*/*` works # most reliably. See the help on how to define wget/curl to download # them as well. import re |
︙ | |||
52 53 54 55 56 57 58 | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | - + | catmap = {"Chiptune": "54", "Electronic - Ambient": "2", "Electronic - Other": "100", "Rock (general)": "13", "Trance - Hard": "64", "Swing": "75", "Rock - Soft": "15", "R & B": "26", "Big Band": "74", "Ska": "24", "Electronic - Rave": "65", "Electronic - Progressive": "11", "Piano": "59", "Comedy": "45", "Christmas": "72", "Chillout": "106", "Reggae": "27", "Electronic - Industrial": "34", "Grunge": "103", "Medieval": "28", "Demo Style": "55", "Orchestral": "50", "Soundtrack": "43", "Electronic - Jungle": "60", "Fusion": "102", "Electronic - IDM": "99", "Ballad": "56", "Country": "18", "World": "42", "Jazz - Modern": "31", "Video Game": "8", "Funk": "32", "Electronic - Drum & Bass": "6", "Alternative": "48", "Electronic - Minimal": "101", "Electronic - Gabber": "40", "Vocal Montage": "76", "Metal (general)": "36", "Electronic - Breakbeat": "9", "Soul": "25", "Electronic (general)": "1", "Punk": "35", "Pop - Synth": "61", "Electronic - Dance": "3", "Pop (general)": "12", "Trance - Progressive": "85", "Trance (general)": "71", "Disco": "58", "Electronic - House": "10", "Experimental": "46", "Trance - Goa": "66", "Rock - Hard": "14", "Trance - Dream": "67", "Spiritual": "47", "Metal - Extreme": "37", "Jazz (general)": "29", "Trance - Tribal": "70", "Classical": "20", "Hip-Hop": "22", "Bluegrass": "105", "Halloween": "82", "Jazz - Acid": "30", "Easy Listening": "107", "New Age": "44", "Fantasy": "52", "Blues": "19", "Other": "41", "Trance - Acid": "63", "Gothic": "38", "Electronic - Hardcore": "39", "One Hour Compo": "53", "Pop - Soft": "62", "Electronic - Techno": "7", "Religious": "49", "Folk": "21"} categories = [] # refresh category list def update_categories(self): |
︙ | |||
84 85 86 87 88 89 90 | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | - + | # download links from dmoz listing def update_streams(self, cat): url = "http://modarchive.org/index.php" params = dict(query=self.catmap[cat], request="search", search_type="genre") |
︙ |
Modified channels/myoggradio.py from [cce93c4126] to [cb87a3782b].
︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - + | # from channels import * from config import * import action from uikit import uikit |
︙ | |||
76 77 78 79 80 81 82 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - + - + | # result list entries = [] # common if (cat == "common"): # fetch |
︙ | |||
109 110 111 112 113 114 115 | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | - + | # get data row = self.parent.row() if row: row = copy.copy(row) # convert PLS/M3U link to direct ICY stream url if conf.myoggradio_morph and self.parent.channel().listformat != "url/direct": |
︙ | |||
152 153 154 155 156 157 158 | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | - + - + - + | "typ": e["format"][6:], "eintragen": "eintragen", # form } # just push data in, like the form does if form: self.login() |
︙ |
Modified channels/punkcast.py from [2ac5815def] to [f6c4524b4e].
︙ | |||
20 21 22 23 24 25 26 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - + | # # Punkcast is no longer updated. This plugin is kept for # historic reasons. It was one of the default streamtuner1 # channels. import re |
︙ | |||
52 53 54 55 56 57 58 | 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 | - + - + | <a\shref="(http://punkcast.com/(\d+)/index.html)"> .*? ALT="([^<">]+)" """, re.S|re.X) entries = [] #-- all from frontpage |
Modified channels/radiobrowser.py from [11cf6e90ac] to [0a40d436ac].
︙ | |||
33 34 35 36 37 38 39 | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - + | # Also has a neat JSON API, so is quite easy to support. import re import json from config import * from channels import * |
︙ | |||
108 109 110 111 112 113 114 | 108 109 110 111 112 113 114 115 116 117 118 119 120 | - + | bitrate = - int(e["negativevotes"]), )) return r # fetch multiple pages def api(self, method, params={}): |
Modified channels/shoutcast.py from [7ab0770356] to [fe5a39c8bf].
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + | # Shoutcast is a server software for audio streaming. It automatically spools # station information on shoutcast.com # # It has been aquired by Radionomy in 2014, since then significant changes # took place. The former yellow pages API got deprecated. |
︙ | |||
62 63 64 65 66 67 68 | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | - + | # redefine streams = {} # Extracts the category list from www.shoutcast.com, # stores a catmap (title => id) def update_categories(self): |
︙ | |||
99 100 101 102 103 104 105 | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | - + | id = self.catmap[cat] # page url = "http://www.shoutcast.com/Home/BrowseByGenre" params = { "genrename": cat } referer = None try: |
︙ |
Modified channels/surfmusik.py from [c2116e521c] to [42aa02e156].
︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | - + | # TV stations don't seem to work mostly. And loading the webtv/ pages would # be somewhat slow (for querying the actual mms:// streams). # # # import re |
︙ | |||
92 93 94 95 96 97 98 | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | - + | """, re.X) r = [] # Add main categories, and fetch subentries (genres or country names) for cat in cats[lang]: r.append(cat) if map.get(cat): |
︙ | |||
127 128 129 130 131 132 133 | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | - + - + | path = path_genre # country else: path = path_country if path is not None: ucat = cat.replace(" ", "+").lower() |
︙ |
Modified channels/tunein.py from [0bca890c80] to [ed1a42d71d].
︙ | |||
24 25 26 27 28 29 30 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | - + | # import re import json from config import * from channels import * |
︙ | |||
82 83 84 85 86 87 88 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - + | }) return r # Fetch OPML, convert outline elements to dicts def api(self, method): r = [] |
Modified channels/xiph.py from [c02f4fea70] to [f7d2f8fd13].
︙ | |||
25 26 27 28 29 30 31 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | - + | # # The category list is hardwired in this plugin. # from config import * from uikit import uikit |
︙ | |||
100 101 102 103 104 105 106 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | - + | params = {} if cat: params["cat"] = cat.lower() if search: params["search"] = search #-- get data |
︙ |