display a warning when no URL is available on media

This commit is contained in:
Romain Bignon 2011-08-04 09:24:38 +02:00
commit d9e174d4c1

View file

@ -96,6 +96,10 @@ class Videoob(ReplApplication):
print >>sys.stderr, 'Video not found: %s' % _id
return 3
if not video.url:
print >>sys.stderr, 'Error: the direct URL is not available.'
return 4
def check_exec(executable):
with open('/dev/null', 'w') as devnull:
process = subprocess.Popen(['which', executable], stdout=devnull)
@ -145,10 +149,13 @@ class Videoob(ReplApplication):
if not video:
print >>sys.stderr, 'Video not found: %s' % _id
return 3
if not video.url:
print >>sys.stderr, 'Error: the direct URL is not available.'
return 4
try:
player_name = self.config.get('media_player')
if not player_name:
self.logger.debug(u'You can set the media_player key to the player you prefer in the videoob '
self.logger.info(u'You can set the media_player key to the player you prefer in the videoob '
'configuration file.')
self.player.play(video, player_name=player_name)
except (InvalidMediaPlayer, MediaPlayerNotFound), e: