Check-in [24a5fe69a1]
Comment: | Add workaround for ArgumentParser, which tries to map config: descriptors onto AP.add_argument(*yikes) params. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
24a5fe69a17765e7fd94431b90884c19 |
User & Date: | mario on 2015-04-06 18:55:12 |
Original Comment: | Add workaround for ArgumentParser, which tries to map config: descriptors onto AP.add_argument() params. (yikes) |
Other Links: | manifest | tags |
2015-04-07
| ||
05:51 | Move argv initialization to conf.apply_args(). Document config: format for argparse conversion. Enable file=sys.stderr for __print__/debug messages. check-in: 1eea3140f8 user: mario tags: trunk | |
2015-04-06
| ||
18:55 | Add workaround for ArgumentParser, which tries to map config: descriptors onto AP.add_argument(*yikes) params. check-in: 24a5fe69a1 user: mario tags: trunk | |
18:53 |
Add UserAgentSwitcher plugin. (Just for experimenting really, not required.)
| |
Modified Makefile from [0d018ef979] to [d3f05bad3b].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | - + | # Requires # · http://fossil.include-once.org/versionnum/ # · http://fossil.include-once.org/xpm/ SHELL := /bin/bash #(for brace expansion) NAME := streamtuner2 VERSION := $(shell version get:plugin st2.py || echo 2.1dev) DEST := /usr/share/streamtuner2 INST := install -m 644 PACK := xpm |
Modified cli.py from [b00bb5a675] to [436f001346].
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 | - + - + - - + + + + + + - + | # channel plugins channel_modules = ["shoutcast", "xiph", "internet_radio", "jamendo", "myoggradio", "live365"] current_channel = "cli" plugins = {} # only populated sparsely by .stream() # start |
Modified config.py from [2154593dfb] to [af23ce772a].
1 2 3 4 5 6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - + + + + + + | # # encoding: UTF-8 # api: streamtuner2 # type: class # title: global config object # description: reads ~/.config/streamtuner/*.json files |
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | + | import platform import re from compat2and3 import gzip_decode, find_executable import zlib import zipfile import inspect import pkgutil import argparse # export symbols __all__ = ["conf", "__print__", "dbg", "plugin_meta", "module_list", "get_data", "find_executable"] #-- create a stub instance of config object conf = object() |
48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | + | # Global configuration store # # Autointializes itself on startup, makes conf.vars available. # Also provides .load() and .save() for JSON data/cache files. # class ConfigDict(dict): args = {} # start def __init__(self): # object==dict means conf.var is conf["var"] self.__dict__ = self # let's pray this won't leak memory due to recursion issues |
73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | + + + | del last["share"] self.update(last) self.migrate() # store defaults in file else: self.save("settings") self.firstrun = 1 # add argv self.args = self.init_args(argparse.ArgumentParser()) # some defaults def defaults(self): self.play = { "audio/mpeg": self.find_player(), "audio/ogg": self.find_player(), |
245 246 247 248 249 250 251 | 255 256 257 258 259 260 261 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 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | except: netrc = parser(self.xdg() + "/netrc").hosts except: pass for server in varhosts: if server in netrc: return netrc[server] |
Modified st2.py from [a62db5a28b] to [2915a6cb3f].
487 488 489 490 491 492 493 | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | - - - - - - + + + + + + - - - - + + - + - + | # startup procedure def main(): |
Modified uikit.py from [c920bbe1ed] to [594d66e076].
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - + | import inspect from compat2and3 import unicode, xrange, PY3, gzip_decode # gtk version (2=gtk2, 3=gtk3, 7=tk;) ver = 2 # if running on Python3 or with commandline flag |