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
|
for bin in players[typ]:
if find_executable(bin.split()[0]):
return bin
return default
# Windows look for c:/program files/*/*.exe
def find_player_win(self, typ="audio", default="wmplayer %asx", append=""):
base = [os.environ["ProgramFiles"], "c:\\windows", "c:\\program files", "c:\\windows\\internet explorer\\"]
players = {
"audio": ["\\VLC*\\vlc.exe", "wmplayer.exe %asx"],
"browser": ["\\Moz*\\firefox.exe", "iexplore.exe %url"],
"xterm": ['/D "C:\\program files\\streamripper" streamripper.exe %srv']
}
typ = typ if typ in players else "audio"
for bin in players[typ]:
for b in base:
fn = glob.glob(b + bin)
if len(fn):
return fn[0] + append
return players[typ][-1]
# http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
def xdg(self, path="/streamtuner2"):
home = os.environ.get("HOME", self.tmp)
config = os.environ.get("XDG_CONFIG_HOME", os.environ.get("APPDATA", home+"/.config"))
|
>
|
|
|
|
|
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
|
for bin in players[typ]:
if find_executable(bin.split()[0]):
return bin
return default
# Windows look for c:/program files/*/*.exe
def find_player_win(self, typ="audio", default="wmplayer %asx", append=""):
pf = os.environ["ProgramFiles"]
base = [pf, "c:\\windows", "c:\\program files", "c:\\windows\\internet explorer\\"]
players = {
"audio": ["\\VideoLAN\\VLC*\\vlc.exe", "\\VLC*\\vlc.exe", "wmplayer.exe %asx"],
"browser": ["\\Moz*\\firefox.exe", "iexplore.exe %url"],
"xterm": ['/D "'+pf+'\\streamripper" streamripper.exe %srv']
}
typ = typ if typ in players else "audio"
for bin in players[typ]:
for b in base:
fn = glob.glob(b + bin)
if len(fn):
return re.sub("^(.+?)(\s%\w+)?$", '"\\g<1>"\\g<2>', fn[0], 1) + append
return players[typ][-1]
# http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
def xdg(self, path="/streamtuner2"):
home = os.environ.get("HOME", self.tmp)
config = os.environ.get("XDG_CONFIG_HOME", os.environ.get("APPDATA", home+"/.config"))
|