|
|
@ -548,10 +548,8 @@ def convert(ctx,
|
|
|
|
|
|
|
|
|
|
|
|
targetSuffices = {}
|
|
|
|
targetSuffices = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mediaFileProperties = FileProperties(context, sourcePath)
|
|
|
|
mediaFileProperties = FileProperties(context, sourcePath)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ssc = ShiftedSeasonController(context)
|
|
|
|
ssc = ShiftedSeasonController(context)
|
|
|
|
|
|
|
|
|
|
|
|
showId = mediaFileProperties.getShowId()
|
|
|
|
showId = mediaFileProperties.getShowId()
|
|
|
@ -599,8 +597,28 @@ def convert(ctx,
|
|
|
|
checkUniqueDispositions(context, targetMediaDescriptor)
|
|
|
|
checkUniqueDispositions(context, targetMediaDescriptor)
|
|
|
|
currentShowDescriptor = currentPattern.getShowDescriptor(ctx.obj)
|
|
|
|
currentShowDescriptor = currentPattern.getShowDescriptor(ctx.obj)
|
|
|
|
|
|
|
|
|
|
|
|
if len(sourceMediaDescriptor.getTrackDescriptors()) != len(targetMediaDescriptor.getTrackDescriptors()):
|
|
|
|
|
|
|
|
raise click.ClickException(f"Number of source streams differs from stored media descriptor")
|
|
|
|
# Check if source and target track descriptors match
|
|
|
|
|
|
|
|
sourceTrackDescriptorList = sourceMediaDescriptor.getTrackDescriptors()
|
|
|
|
|
|
|
|
targetTrackDescriptorList = targetMediaDescriptor.getTrackDescriptors()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ttd in targetTrackDescriptorList:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tti = ttd.getIndex()
|
|
|
|
|
|
|
|
ttsi = ttd.getSourceIndex()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stList = [st for st in sourceTrackDescriptorList if st.getIndex() == ttsi]
|
|
|
|
|
|
|
|
std = stList[0] if stList else None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if std is None:
|
|
|
|
|
|
|
|
raise click.ClickException(f"Target track #{tti} refering to non-existent source track #{ttsi}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ttType = ttd.getType()
|
|
|
|
|
|
|
|
stType = std.getType()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ttType != stType:
|
|
|
|
|
|
|
|
raise click.ClickException(f"Target track #{tti} type ({ttType.label()}) not matching source track #{ttsi} type ({stType.label()})")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if context['import_subtitles']:
|
|
|
|
if context['import_subtitles']:
|
|
|
|
targetMediaDescriptor.importSubtitles(context['subtitle_directory'],
|
|
|
|
targetMediaDescriptor.importSubtitles(context['subtitle_directory'],
|
|
|
@ -681,12 +699,8 @@ def convert(ctx,
|
|
|
|
|
|
|
|
|
|
|
|
for chainIteration in chainYield:
|
|
|
|
for chainIteration in chainYield:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctx.obj['logger'].debug(f"\nchain iteration: {chainIteration}\n")
|
|
|
|
ctx.obj['logger'].debug(f"\nchain iteration: {chainIteration}\n")
|
|
|
|
|
|
|
|
|
|
|
|
# if len(q_list) > 1:
|
|
|
|
|
|
|
|
# targetSuffices['q'] = f"q{q}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chainVariant = '-'.join([fy['variant'] for fy in chainIteration])
|
|
|
|
chainVariant = '-'.join([fy['variant'] for fy in chainIteration])
|
|
|
|
|
|
|
|
|
|
|
|
ctx.obj['logger'].debug(f"\nRunning job {jobIndex} file={sourcePath} variant={chainVariant}")
|
|
|
|
ctx.obj['logger'].debug(f"\nRunning job {jobIndex} file={sourcePath} variant={chainVariant}")
|
|
|
@ -695,37 +709,20 @@ def convert(ctx,
|
|
|
|
ctx.obj['logger'].debug(f"label={label if label else 'Falsy'}")
|
|
|
|
ctx.obj['logger'].debug(f"label={label if label else 'Falsy'}")
|
|
|
|
ctx.obj['logger'].debug(f"sourceFileBasename={sourceFileBasename}")
|
|
|
|
ctx.obj['logger'].debug(f"sourceFileBasename={sourceFileBasename}")
|
|
|
|
|
|
|
|
|
|
|
|
# targetFileBasename = mediaFileProperties.assembleTargetFileBasename(label,
|
|
|
|
|
|
|
|
# q if len(q_list) > 1 else -1,
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
targetFileBasename = sourceFileBasename if context['use_tmdb'] and not label else label
|
|
|
|
targetFileBasename = sourceFileBasename if context['use_tmdb'] and not label else label
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
targetFilenameTokens = [targetFileBasename]
|
|
|
|
targetFilenameTokens = [targetFileBasename]
|
|
|
|
|
|
|
|
|
|
|
|
if 'se' in targetSuffices.keys():
|
|
|
|
if 'se' in targetSuffices.keys():
|
|
|
|
targetFilenameTokens += [targetSuffices['se']]
|
|
|
|
targetFilenameTokens += [targetSuffices['se']]
|
|
|
|
|
|
|
|
|
|
|
|
# if 'q' in targetSuffices.keys():
|
|
|
|
|
|
|
|
# targetFilenameTokens += [targetSuffices['q']]
|
|
|
|
|
|
|
|
for filterYield in chainIteration:
|
|
|
|
for filterYield in chainIteration:
|
|
|
|
|
|
|
|
|
|
|
|
# filterIdentifier = filterYield['identifier']
|
|
|
|
|
|
|
|
# filterParameters = filterYield['parameters']
|
|
|
|
|
|
|
|
# filterSuffices = filterYield['suffices']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
targetFilenameTokens += filterYield['suffices']
|
|
|
|
targetFilenameTokens += filterYield['suffices']
|
|
|
|
|
|
|
|
|
|
|
|
#TODO #387
|
|
|
|
|
|
|
|
# targetFilename = ((f"{sourceFileBasename}_q{q}" if len(q_list) > 1 else sourceFileBasename)
|
|
|
|
|
|
|
|
# if context['use_tmdb'] else targetFileBasename)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
targetFilename = f"{'_'.join(targetFilenameTokens)}.{targetExtension}"
|
|
|
|
targetFilename = f"{'_'.join(targetFilenameTokens)}.{targetExtension}"
|
|
|
|
|
|
|
|
|
|
|
|
# targetPath = os.path.join(output_directory if output_directory else sourceDirectory, targetFilename)
|
|
|
|
|
|
|
|
targetPath = os.path.join(output_directory, targetFilename) if output_directory else targetFilename
|
|
|
|
targetPath = os.path.join(output_directory, targetFilename) if output_directory else targetFilename
|
|
|
|
|
|
|
|
|
|
|
|
#TODO: target extension anpassen
|
|
|
|
|
|
|
|
ctx.obj['logger'].info(f"Creating file {targetFilename}")
|
|
|
|
ctx.obj['logger'].info(f"Creating file {targetFilename}")
|
|
|
|
|
|
|
|
|
|
|
|
fc.runJob(sourcePath,
|
|
|
|
fc.runJob(sourcePath,
|
|
|
@ -734,8 +731,6 @@ def convert(ctx,
|
|
|
|
context['video_encoder'],
|
|
|
|
context['video_encoder'],
|
|
|
|
chainIteration)
|
|
|
|
chainIteration)
|
|
|
|
|
|
|
|
|
|
|
|
#TODO: click.confirm('Warning! This file is not compliant to the defined source schema! Do you want to continue?', abort=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endTime = time.perf_counter()
|
|
|
|
endTime = time.perf_counter()
|
|
|
|
ctx.obj['logger'].info(f"\nDONE\nTime elapsed {endTime - startTime}")
|
|
|
|
ctx.obj['logger'].info(f"\nDONE\nTime elapsed {endTime - startTime}")
|
|
|
|
|
|
|
|
|
|
|
|