Check-in [4298cc4385]
Overview
Comment: | windows patches from Vincent |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4298cc4385dfa6c18ec5183f15ebae55 |
User & Date: | mario on 2012-01-10 03:47:54 |
Other Links: | manifest | tags |
Context
2012-01-10
| ||
03:49 | minor gui tweaks check-in: f2592fc1e4 user: mario tags: trunk | |
03:47 | windows patches from Vincent check-in: 4298cc4385 user: mario tags: trunk | |
00:09 | Updated win_config dialog, made it resizable. mini-help is disabled (tooltip became tooltip_text in preparation for Gtk3), glade-3.10 killed the "theme" dropdown. check-in: d5904985a0 user: mario tags: trunk | |
Changes
Modified action.py from [a384a5d7ee] to [f63b7b9614].
︙ | ︙ | |||
44 45 46 47 48 49 50 | # class action: # streamlink formats lt = {"asx":"video/x-ms-asf", "pls":"audio/x-scpls", "m3u":"audio/x-mpegurl", "xspf":"application/xspf+xml", "href":"url/http", "ram":"audio/x-pn-realaudio", "smil":"application/smil"} # media formats mf = {"mp3":"audio/mp3", "ogg":"audio/ogg", "aac":"audio/aac"} | | | | > > > > > | | > > | > > | | 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 | # class action: # streamlink formats lt = {"asx":"video/x-ms-asf", "pls":"audio/x-scpls", "m3u":"audio/x-mpegurl", "xspf":"application/xspf+xml", "href":"url/http", "ram":"audio/x-pn-realaudio", "smil":"application/smil"} # media formats mf = {"mp3":"audio/mp3", "ogg":"audio/ogg", "aac":"audio/aac"} # web @staticmethod def browser(url): __print__( conf.browser ) action.run(conf.browser + " " + action.quote(url)) # os shell cmd escaping @staticmethod def quote(s): if conf.windows: return s # should actually be "\\\"%s\\\"" % s else: return "%r" % s # calls player for stream url and format @staticmethod def play(url, audioformat="audio/mp3", listformat="text/x-href"): if (url): url = action.url(url, listformat) if (audioformat): if audioformat == "audio/mpeg": audioformat = "audio/mp3" # internally we use the more user-friendly moniker cmd = conf.play.get(audioformat, conf.play.get("*/*", "vlc %u")) __print__( "play", url, cmd ) try: action.run( action.interpol(cmd, url) ) except: pass # exec wrapper @staticmethod def run(cmd): if conf.windows: os.system("start \"%s\"") else: os.system(cmd + " &") # streamripper @staticmethod def record(url, audioformat="audio/mp3", listformat="text/x-href", append="", row={}): __print__( "record", url ) cmd = conf.record.get(audioformat, conf.record.get("*/*", None)) |
︙ | ︙ | |||
219 220 221 222 223 224 225 | # use shoutcast unique stream id if available stream_id = re.search("http://.+?/.*?(\d+)", pls, re.M) stream_id = stream_id and stream_id.group(1) or "XXXXXX" try: channelname = main.current_channel except: channelname = "unknown" | | | | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | # use shoutcast unique stream id if available stream_id = re.search("http://.+?/.*?(\d+)", pls, re.M) stream_id = stream_id and stream_id.group(1) or "XXXXXX" try: channelname = main.current_channel except: channelname = "unknown" return (conf.tmp + os.sep + "streamtuner2."+channelname+"."+stream_id+".m3u", len(stream_id) > 3 and stream_id != "XXXXXX") # check if there are any urls in a given file @staticmethod def has_urls(tmp_fn): if os.path.exists(tmp_fn): return open(tmp_fn, "r").read().find("http://") > 0 |
︙ | ︙ | |||
260 261 262 263 264 265 266 | __print__( "error, there were no URLs in ", pls ) raise "Empty PLS" # open help browser @staticmethod def help(*args): | | | 269 270 271 272 273 274 275 276 277 278 279 280 281 | __print__( "error, there were no URLs in ", pls ) raise "Empty PLS" # open help browser @staticmethod def help(*args): action.run("yelp /usr/share/doc/streamtuner2/help/") #or action.browser("/usr/share/doc/streamtuner2/") #class action |
Modified config.py from [791971aff7] to [3cd51eb7d8].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # import os import sys import pson import gzip #-- create a single instance of config object conf = object() | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # import os import sys import pson import gzip import platform #-- create a single instance of config object conf = object() |
︙ | ︙ | |||
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 | self.retain_deleted = 1 self.auto_save_appstate = 1 self.theme = "" #"MountainDew" self.debug = False self.channel_order = "shoutcast, xiph, internet_radio_org_uk, jamendo, myoggradio, .." self.reuse_m3u = 1 self.google_homepage = 1 # each plugin has a .config dict list, we add defaults here def add_plugin_defaults(self, config, module=""): # options for opt in config: if ("name" in opt) and ("value" in opt) and (opt["name"] not in vars(self)): self.__dict__[opt["name"]] = opt["value"] # plugin state if module and module not in conf.plugins: conf.plugins[module] = 1 # http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html def xdg(self): home = os.environ.get("HOME", self.tmp) | > | | | 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 108 109 110 111 112 113 114 115 116 117 118 119 120 | self.retain_deleted = 1 self.auto_save_appstate = 1 self.theme = "" #"MountainDew" self.debug = False self.channel_order = "shoutcast, xiph, internet_radio_org_uk, jamendo, myoggradio, .." self.reuse_m3u = 1 self.google_homepage = 1 self.windows = platform.system()=="Windows" # each plugin has a .config dict list, we add defaults here def add_plugin_defaults(self, config, module=""): # options for opt in config: if ("name" in opt) and ("value" in opt) and (opt["name"] not in vars(self)): self.__dict__[opt["name"]] = opt["value"] # plugin state if module and module not in conf.plugins: conf.plugins[module] = 1 # http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html def xdg(self): home = os.environ.get("HOME", self.tmp) config = os.environ.get("XDG_CONFIG_HOME", os.environ.get("APPDATA", home+"/.config")) # storage dir self.dir = config + "/streamtuner2" # create if necessary if (not os.path.exists(self.dir)): os.makedirs(self.dir) # store some configuration list/dict into a file |
︙ | ︙ |