]> git.wh0rd.org Git - home.git/commitdiff
vlc-rc: polish behavior a bit
authorMike Frysinger <vapier@gentoo.org>
Thu, 20 Oct 2016 02:21:04 +0000 (19:21 -0700)
committerMike Frysinger <vapier@gentoo.org>
Thu, 20 Oct 2016 02:21:04 +0000 (19:21 -0700)
.bin/vlc-rc

index ef6bb1e7cad307befab4f3c500655c2ddb3299a6..f2d0d617c89aeb4ab9f876e5b4e208c5292423ba 100755 (executable)
@@ -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)