def __init__(self, videofile, vlc_bin=None): self.videofile = videofile self.vlc_bin = vlc_bin or find_vlc() cmd = \ [self.vlc_bin] + \ shlex.split('--intf lua --lua-intf dumpmeta --no-video-title ' + \ '--no-media-library -V dummy -A dummy') + \ [self.videofile, 'vlc://quit'] process = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) self.stdout, self.stderr = process.communicate()
def __init__(self, command_args, vlc_bin=None, timeout=120, \ verbose=False, debug=False, error_on_segfault=True): # specific command line arguments to pass to VLC self.command_args = command_args # path to the VLC executable self.vlc_bin = vlc_bin or find_vlc() # say something? self.verbose = verbose # do something to support debugging the underlying VLC self.debug = debug # the subprocess reference self.process = None # the subprocess will be started in another thread self.thread = None # for timing out the operation self.timer = None self.timeout = timeout # indicates whether we are currently terminating ourselves regularly self.terminating = False # indicates whether a timeout occurred self.timeout_occurred = False # for monitoring VLC's log file self.logmonitor = None self.logfile = NamedTemporaryFile(delete=not self.debug) # time keeping self.begin = 0 self.finish = 0 # whether processing was successful self.success = None # whether to error or warn on segfault self.error_on_segfault = error_on_segfault