arg = sys.argv.pop(1) if arg.lower() in ('-v', '--version'): # show all versions, sample output on macOS: # % python3 ./tkvlc.py -v # tkvlc.py: 2019.07.28 (tkinter 8.6 /Library/Frameworks/Python.framework/Versions/3.7/lib/libtk8.6.dylib) # vlc.py: 3.0.6109 (Sun Mar 31 20:14:16 2019 3.0.6) # LibVLC version: 3.0.6 Vetinari (0x3000600) # LibVLC compiler: clang: warning: argument unused during compilation: '-mmacosx-version-min=10.7' [-Wunused-command-line-argument] # Plugin path: /Applications/VLC3.0.6.app/Contents/MacOS/plugins # Python: 3.7.4 (64bit) macOS 10.13.6 # Print version of this vlc.py and of the libvlc print('%s: %s (%s %s %s)' % (basename(__file__), __version__, Tk.__name__, Tk.TkVersion, libtk)) try: vlc.print_version() vlc.print_python() except AttributeError: pass sys.exit(0) elif arg.startswith('-'): print('usage: %s [-v | --version] [<video_file_name>]' % (sys.argv[0], )) sys.exit(1) elif arg: # video file _video = expanduser(arg) if not isfile(_video): print('%s error: no such file: %r' % (sys.argv[0], arg)) sys.exit(1)
_marquee = True elif '-raiser'.startswith(t) and len(t) > 1: _raiser = True elif '-snapshot-format'.startswith(t) and len(t) > 1 and args: _snapshot = args.pop(0) elif '-timeout'.startswith(t) and len(t) > 3 and args: _timeout = args.pop(0) elif '-title'.startswith(t) and len(t) > 3 and args: _title = args.pop(0).strip() elif t in ('-v', '--version'): # Print version of this cocoavlc.py, PyCocoa, etc. print('%s: %s (%s %s %s)' % (basename(__file__), __version__, _pycocoa_, _pycocoa_version, _macOS(sep=' '))) try: vlc.print_version() # PYCHOK expected vlc.print_python() # PYCHOK expected except AttributeError: pass sys.exit(0) else: printf('invalid option: %s', o, argv0=_argv0) sys.exit(1) if _raiser: # get traceback at SIG- faults or ... try: # ... use: python3 -X faulthandler ... import faulthandler faulthandler.enable() except ImportError: # not in Python 3.3- pass