From 8250a409a027b89d315026b8695e3268bfd6f53a Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 19 Oct 2016 19:21:04 -0700 Subject: [PATCH] vlc-rc: polish behavior a bit --- .bin/vlc-rc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.bin/vlc-rc b/.bin/vlc-rc index ef6bb1e..f2d0d61 100755 --- a/.bin/vlc-rc +++ b/.bin/vlc-rc @@ -56,7 +56,8 @@ def connection(host, port, quiet=False): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: if not quiet: - print('Connecting to %s:%s ...' %(host, port), end='') + print('Connecting to %s:%s ... ' %(host, port), end='') + sys.stdout.flush() try: s.connect((host, port)) except socket.error as e: @@ -101,7 +102,7 @@ class VlcConsole(code.InteractiveConsole): try: result += self.server.recv(1024 * 1024) except socket.timeout: - if result: + if '\n' in result: break if passthru: self.write(result) @@ -194,7 +195,11 @@ class VlcConsole(code.InteractiveConsole): offset *= -1 position = current_position + offset else: - position = opts.position + try: + position = int(opts.position) + except ValueError: + logging.error('seek takes an int, not "%s"', opts.position) + return self._run_command('seek %s' % (position,), passthru=True) -- 2.39.5