def recording_command(event):
conf = config('<STR_LIT>')<EOL>cmd = conf['<STR_LIT>']<EOL>cmd = cmd.replace('<STR_LIT>', str(event.remaining_duration(timestamp())))<EOL>cmd = cmd.replace('<STR_LIT>', event.directory())<EOL>cmd = cmd.replace('<STR_LIT>', event.name())<EOL>cmd = cmd.replace('<STR_LIT>', conf['<STR_LIT>'])<EOL>sigterm_time = conf['<STR_LIT>']<EOL>sigkill_time = conf['<STR_LIT>']<EOL>sigcustom_time = conf['<STR_LIT>']<EOL>sigcustom_time = <NUM_LIT:0> if sigcustom_time < <NUM_LIT:0> else event.end + sigcustom_time<EOL>sigterm_time = <NUM_LIT:0> if sigterm_time < <NUM_LIT:0> else event.end + sigterm_time<EOL>sigkill_time = <NUM_LIT:0> if sigkill_time < <NUM_LIT:0> else event.end + sigkill_time<EOL>logger.info(cmd)<EOL>args = shlex.split(cmd)<EOL>DEVNULL = getattr(subprocess, '<STR_LIT>', os.open(os.devnull, os.O_RDWR))<EOL>captureproc = subprocess.Popen(args, stdin=DEVNULL)<EOL>hasattr(subprocess, '<STR_LIT>') or os.close(DEVNULL)<EOL>notify.notify('<STR_LIT>')<EOL>while captureproc.poll() is None:<EOL><INDENT>notify.notify('<STR_LIT>')<EOL>if sigcustom_time and timestamp() > sigcustom_time:<EOL><INDENT>logger.info("<STR_LIT>")<EOL>captureproc.send_signal(conf['<STR_LIT>'])<EOL>sigcustom_time = <NUM_LIT:0>  <EOL><DEDENT>if sigterm_time and timestamp() > sigterm_time:<EOL><INDENT>logger.info("<STR_LIT>")<EOL>captureproc.terminate()<EOL>sigterm_time = <NUM_LIT:0>  <EOL><DEDENT>elif sigkill_time and timestamp() > sigkill_time:<EOL><INDENT>logger.warning("<STR_LIT>")<EOL>captureproc.kill()<EOL>sigkill_time = <NUM_LIT:0>  <EOL><DEDENT>time.sleep(<NUM_LIT:0.1>)<EOL><DEDENT>for preview in conf['<STR_LIT>']:<EOL><INDENT>try:<EOL><INDENT>os.remove(preview.replace('<STR_LIT>', conf['<STR_LIT>']))<EOL><DEDENT>except OSError:<EOL><INDENT>logger.warning('<STR_LIT>')<EOL>logger.warning(traceback.format_exc())<EOL><DEDENT><DEDENT>exitcode = config()['<STR_LIT>']['<STR_LIT>']<EOL>if captureproc.poll() > <NUM_LIT:0> and captureproc.returncode != exitcode:<EOL><INDENT>raise RuntimeError('<STR_LIT>' % captureproc.returncode)<EOL><DEDENT>notify.notify('<STR_LIT>')<EOL>files = (f.replace('<STR_LIT>', event.directory()) for f in conf['<STR_LIT>'])<EOL>files = (f.replace('<STR_LIT>', event.name()) for f in files)<EOL>return list(zip(conf['<STR_LIT>'], files))<EOL>
Run the actual command to record the a/v material.