Revision a5afc963
Added by David Sorber over 7 years ago
| software/hbkcd/hbkcd/queue.py | ||
|---|---|---|
|
|
||
|
# Re-set positions for all items
|
||
|
ctr = 1
|
||
|
for item in self.queue[]
|
||
|
for item in self.queue:
|
||
|
item.position = ctr
|
||
|
ctr += 1
|
||
|
|
||
| ... | ... | |
|
|
||
|
class QueueItem(object):
|
||
|
|
||
|
def __init__(self, path):
|
||
|
def __init__(self, path, output_file):
|
||
|
self.path = path
|
||
|
self.filename = os.path.basename(path)
|
||
|
self.output_file = output_file
|
||
|
self.position = None
|
||
|
self.in_progress = False
|
||
|
self.status = 'queued'
|
||
| ... | ... | |
|
def get_dict_rep(self):
|
||
|
return {'position': self.position,
|
||
|
'path': self.path,
|
||
|
'output_file': self.output_file,
|
||
|
'in_progress': self.in_progress,
|
||
|
'status': self.status,
|
||
|
'width': self.width,
|
||
| ... | ... | |
|
'encode_finished': format_ds(self.encode_finished)}
|
||
|
|
||
|
def update_status(self, stdout_iter):
|
||
|
logging.info('Update status thread running for: {:s}'.format(self.path))
|
||
|
logging.debug('Update status thread running for: {:s}'.format(self.path))
|
||
|
for stdout_line in stdout_iter:
|
||
|
# Naturally this is very specific parsing for the HBK output
|
||
|
try:
|
||
|
self.status = stdout_line.strip().split(',', 1)[1].strip()
|
||
|
except IndexError:
|
||
|
self.status = stdout_line
|
||
|
logging.info('Update status thread terminating')
|
||
|
|
||
|
|
||
|
logging.debug('Update status thread terminating')
|
||
|
|
||
|
def build_hbk_cmd(self):
|
||
|
""" Build and return templated HandBrake command.
|
||
|
"""
|
||
|
cmd = HANDBRAKE_CMD
|
||
|
cmd[HANDBRAKE_CMD_INPUT_IDX] = self.path
|
||
|
cmd[HANDBRAKE_CMD_OUTPUT_IDX] = self.output_file
|
||
|
cmd[HANDBRAKE_CMD_FPS_IDX] = self.framerate
|
||
|
|
||
|
if self.convert_audio:
|
||
|
# If converting audio use AAC
|
||
|
# TODO: double check this audio settings make sure VBR is used
|
||
|
cmd[HANDBRAKE_CMD_AUDIO_IDX] = 'fdk_aac --aq 5'
|
||
|
|
||
|
return cmd
|
||
|
|
||
|
# Does this need to be protected?
|
||
|
ENCODE_QUEUE = EncodeQueue()
|
||
Add remove command and helper scripts.