From 52bf1c57acabffd5cf9e1f101c6d52cd6fffdc2c Mon Sep 17 00:00:00 2001 From: Antti Ajanki Date: Thu, 7 Jul 2011 19:48:57 +0300 Subject: slightly safer way of substituting stream name --- src/webvicli/webvicli/client.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/webvicli/webvicli/client.py b/src/webvicli/webvicli/client.py index 3d63080..c15f073 100644 --- a/src/webvicli/webvicli/client.py +++ b/src/webvicli/webvicli/client.py @@ -487,17 +487,17 @@ class WVClient: # Found url, now find a working media player for player in self.streamplayers: if '%s' not in player: - playcmd = player + ' ' + streamurl - else: - try: - # Hack for playing from fifo in VLC - if 'vlc' in player and streamurl.startswith('file://'): - streamurl = 'stream://' + streamurl[len('file://'):] - - playcmd = player % streamurl - except TypeError: - print 'Can\'t substitute URL in', player - continue + player = player + ' %s' + + try: + # Hack for playing from fifo in VLC + if 'vlc' in player and streamurl.startswith('file://'): + streamurl = 'stream://' + streamurl[len('file://'):] + + playcmd = player.replace('%s', streamurl, 1) + except TypeError: + print 'Can\'t substitute URL in', player + continue try: print 'Trying player: ' + playcmd -- cgit v1.2.3