Better way of testing the start of a string

This commit is contained in:
Laurent Bachelier 2012-02-03 23:07:33 +01:00
commit 53915bf6b5
2 changed files with 3 additions and 3 deletions

View file

@ -115,11 +115,11 @@ class Videoob(ReplApplication):
ext = 'avi'
dest = '%s.%s' % (video.id, ext)
if video.url.find('rtmp') == 0:
if video.url.startswith('rtmp'):
if not check_exec('rtmpdump'):
return 1
args = ('rtmpdump', '-r', video.url, '-o', dest)
elif video.url.find('mms') == 0:
elif video.url.startswith('mms'):
if not check_exec('mimms'):
return 1
args = ('mimms', video.url, dest)

View file

@ -82,7 +82,7 @@ class MediaPlayer(object):
player_name = self.guess_player_name()
if player_name is None:
raise MediaPlayerNotFound()
if media.url.find('rtmp') == 0:
if media.url.startswith('rtmp'):
self._play_rtmp(media, player_name)
else:
self._play_default(media, player_name)