Check-in [2335ea7a46]
Overview
Comment: | Move mime_fmt() into regular function. Fix live365 ahttp feedback= bug. Regroup functions and update a few comments in channels/__init__ |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
2335ea7a4687038ce7421643783956dd |
User & Date: | mario on 2015-05-13 00:00:39 |
Other Links: | manifest | tags |
Context
2015-05-13
| ||
19:00 | Make favicon redisplay work after google_find_homepage() and existing icons in cache. Shorter timeout/display for status label for google search. check-in: 56776a4e90 user: mario tags: trunk | |
00:00 | Move mime_fmt() into regular function. Fix live365 ahttp feedback= bug. Regroup functions and update a few comments in channels/__init__ check-in: 2335ea7a46 user: mario tags: trunk | |
2015-05-12
| ||
22:18 | Add default filters only once in GenericChannel.__init__ Allow preprocess_filter callbacks access to current channel object. (Used by filter_bitrate to recognize .audioformat if row[format] is absent.) check-in: ae2f48310a user: mario tags: trunk | |
Changes
Modified Makefile from [014fb4ee72] to [5237489135].
︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 | - + | $(INST) *.desktop -t /usr/share/applications/ $(INST) icon.png /usr/share/pixmaps/streamtuner2.png $(INST) help/str*2.1 -t /usr/share/man/man1/ # start locally st2: run run: |
Modified channels/__init__.py from [51e13176b4] to [5f327fb17e].
︙ | |||
37 38 39 40 41 42 43 | 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 | - + - + - + - - - - + + + + - + + + | import os.path import xml.sax.saxutils import re import copy import inspect |
︙ | |||
88 89 90 91 92 93 94 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | - + - + - + + + + + - + | [False, 20, ["format", str, None, {}], ], [False, 0, ["favourite", bool, None, {}], ], [False, 0, ["deleted", bool, None, {}], ], [False, 0, ["search_col", str, None, {}], ], [False, 0, ["search_set", bool, None, {}], ], ] rowmap = [] # [state,genre,title,...] field enumeration still needed separately |
︙ | |||
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | + + + - + - + - + | self.update_datamap(field, title=title) # Initialize stations TreeView self.columns([]) # add to main menu uikit.add_menu([parent.channelmenuitems], self.meta["title"], lambda w: parent.channel_switch_by_name(self.module) or 1) # Just wraps uikit.columns() to retain liststore, rowmap and pix_entry def columns(self, entries=None): self.ls, self.rowmap, self.pix_entry = uikit.columns(self.gtk_list, self.datamap, entries, show_favicons=conf.show_favicons) # Statusbar stub (defers to parent/main window, if in GUI mode) def status(self, *args, **kw): if self.parent: self.parent.status(*args, **kw) else: log.INFO("status():", *v) #--------------------- streams/model data accesss --------------------------- |
︙ | |||
253 254 255 256 257 258 259 | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | + - + + + + - - + + + + + + + + + + + + + + + - + | except Exception as e: log.ERR_UIKIT("Couldn't set row_icon()", e) #------------------------ base implementations ----------------------------- |
︙ | |||
333 334 335 336 337 338 339 | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | - - - - + - - - - - - - - - - - - - - - - + - - + - | uikit.do(self.gtk_list.scroll_to_point, 0, y + 1) # scroll to previous position, +1 px, because # somehow Gtk.TreeView else stumbles over itself when scrolling to the same position the 2nd time # unset statusbar self.status() |
︙ | |||
399 400 401 402 403 404 405 | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | - - - - - - - - + + + + + + + + + + + - - - - - + - + | if url: url = url.group(0).lower().replace(" ", "") url = (url if url.find("www.") == 0 else "www."+url) row["homepage"] = ahttp.fix_url(url) print row return True |
︙ | |||
458 459 460 461 462 463 464 | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | - + - + | return d elif isinstance(d, (dict)): return self.str_from_struct(d.keys()) or self.str_from_struct(d.values()) elif isinstance(d, (list, tuple)): return d[0] if len(d) else None |
︙ | |||
541 542 543 544 545 546 547 | 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - | audioformat = row.get("format", self.audioformat) listformat = row.get("listformat", self.listformat) action.record(row, audioformat, listformat) return row |
︙ | |||
759 760 761 762 763 764 765 766 | 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 | + + + + + + + + + + + + + + + + + + + + + + + + + | def nl(str): return rx_spc.sub(" ", str).strip() # Combine html tag, escapes and whitespace cleanup def unhtml(str): return nl(entity_decode(strip_tags(str))) # Convert audio format nick/shortnames to mime types, e.g. "OGG" to "audio/ogg" # (only used by few plugin meanwhile, could be merged with action. module now) def mime_fmt(s): # clean string s = s.lower().strip() # rename map = { "audio/mp3":"audio/mpeg", # Note the real mime type is /mpeg, but /mp3 is more understandable in the GUI "ogg":"ogg", "ogm":"ogg", "xiph":"ogg", "vorbis":"ogg", "vnd.xiph.vorbis":"ogg", "mp3":"mpeg", "mp":"mpeg", "mp2":"mpeg", "mpc":"mpeg", "mps":"mpeg", "aac+":"aac", "aacp":"aac", "realaudio":"x-pn-realaudio", "real":"x-pn-realaudio", "ra":"x-pn-realaudio", "ram":"x-pn-realaudio", "rm":"x-pn-realaudio", # yes, we do video "flv":"video/flv", "mp4":"video/mp4", } #map.update(action.listfmt_t) # list type formats (.m3u .pls and .xspf) if map.get(s): s = map[s] # add prefix: if s.find("/") < 1: s = "audio/" + s # return s |
Modified channels/favicon.py from [bdefdbfe53] to [7782a3f227].
︙ | |||
149 150 151 152 153 154 155 156 157 158 159 160 161 162 | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | + | ok = fav_google_ico2png(row["homepage"], favicon_fn) else: ok = fav_from_homepage(row["homepage"], favicon_fn) # Update TreeView if ok: self.update_pixstore(row, pixstore, i) row["favicon"] = favicon_fn # catch HTTP Timeouts etc., so update_all() row processing just continues.. except Exception as e: log.WARN("favicon.update_rows():", e) pass |
︙ |
Modified channels/live365.py from [f2cc1bc432] to [e4e6ca4688].
1 2 3 4 | 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 | - + - + + + + + + + + + + | # api: streamtunter2 # title: Live365 # description: Around 5000 categorized internet radio streams, some paid ad-free ones. |
︙ | |||
77 78 79 80 81 82 83 | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | - + - + | def update_categories(self): pass # extract stream infos def update_streams(self, cat): |
︙ |
Modified channels/xiph.py from [8fa7c91382] to [6ec5e242b7].
︙ | |||
146 147 148 149 150 151 152 | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | - + | else: yp = "<none/>" self.status("Yes, XML parsing isn't much faster either.", timeout=20) for entry in xml.dom.minidom.parseString(yp).getElementsByTagName("entry"): buffy.append({ "title": x(entry, "server_name"), "url": x(entry, "listen_url"), |
︙ | |||
227 228 229 230 231 232 233 | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | - + | title = unhtml(title), homepage = ahttp.fix_url(homepage), playing = unhtml(playing), url = "http://dir.xiph.org{}".format(url), listformat = "xspf", listeners = int(listeners), bitrate = bitrate(bits), |
︙ |
Modified config.py from [f7e98ed69f] to [e3065a7831].
︙ | |||
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - + | args = {} # start def __init__(self): # object==dict means conf.var is conf["var"] |
︙ |
Modified contrib/file.py from [a796fcaf0b] to [c5a4a98a96].
︙ | |||
173 174 175 176 177 178 179 | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | - + | def file_entry(self, fn, dir): # basic data meta = { "title": fn, "filename": fn, "url": "file://" + dir + "/" + fn, "genre": "", |
︙ |
Modified contrib/listenlive.py from [98eef5d460] to [c1d1551be3].
︙ | |||
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 82 83 84 85 86 | - + | r.append(dict( homepage = homepage, playing = location, title = unhtml(title), url = url, genre = genre[0] if genre else cat, bitrate = int(bitrate), |
Modified contrib/punkcast.py from [f6c4524b4e] to [f8b9acfb69].
︙ | |||
79 80 81 82 83 84 85 | 79 80 81 82 83 84 85 86 87 88 89 90 91 | - + | rx_sound = re.compile("""(http://[^"<>]+[.](mp3|ogg|m3u|pls|ram))""") html = ahttp.get(row["homepage"]) # look up ANY audio url for uu in rx_sound.findall(html): log.DATA( uu ) (url, fmt) = uu |