|
|
@ -32,23 +32,29 @@ class Scenario1(Scenario):
|
|
|
|
# * MediaTags -> asserts
|
|
|
|
# * MediaTags -> asserts
|
|
|
|
|
|
|
|
|
|
|
|
for tci in TrackCombination.list():
|
|
|
|
for tci in TrackCombination.list():
|
|
|
|
combinationContext = self._context.copy()
|
|
|
|
# combinationContext = self._context.copy()
|
|
|
|
combinationContext['use_jellyfin'] = False
|
|
|
|
self._context['use_jellyfin'] = True
|
|
|
|
combinationContext['use_tmdb'] = False
|
|
|
|
self._context['use_tmdb'] = False
|
|
|
|
combinationContext['use_pattern'] = False
|
|
|
|
self._context['use_pattern'] = False
|
|
|
|
trackCombination = TrackCombination.getClassReference(tci)(combinationContext)
|
|
|
|
trackCombination = TrackCombination.getClassReference(tci)(self._context)
|
|
|
|
|
|
|
|
|
|
|
|
subcombinations = trackCombination.getSubcombinations()
|
|
|
|
subcombinations = trackCombination.getSubcombinations()
|
|
|
|
if not subcombinations is None:
|
|
|
|
if not subcombinations is None:
|
|
|
|
for trackDescriptors, evaluateFunc, shouldFail in subcombinations:
|
|
|
|
for trackDescriptors, evaluateFunc, shouldFail, combinationIdentifier in subcombinations:
|
|
|
|
|
|
|
|
|
|
|
|
kwargs = {}
|
|
|
|
kwargs = {}
|
|
|
|
kwargs[MediaDescriptor.CONTEXT_KEY] = self._context
|
|
|
|
kwargs[MediaDescriptor.CONTEXT_KEY] = self._context
|
|
|
|
kwargs[MediaDescriptor.TRACK_DESCRIPTOR_LIST_KEY] = trackDescriptors
|
|
|
|
kwargs[MediaDescriptor.TRACK_DESCRIPTOR_LIST_KEY] = trackDescriptors
|
|
|
|
|
|
|
|
self._logger.debug(f"src track dispositions {[d.getDispositionSet() for d in trackDescriptors]}")
|
|
|
|
sourceMediaDescriptor = MediaDescriptor(**kwargs)
|
|
|
|
sourceMediaDescriptor = MediaDescriptor(**kwargs)
|
|
|
|
sourceMediaDescriptor.reindexSubIndices()
|
|
|
|
sourceMediaDescriptor.reindexSubIndices()
|
|
|
|
|
|
|
|
# sourceMediaDescriptor.reindexIndices()
|
|
|
|
|
|
|
|
|
|
|
|
# Phase 1: Setup source files
|
|
|
|
# Phase 1: Setup source files
|
|
|
|
|
|
|
|
# TODO:
|
|
|
|
|
|
|
|
# src track dispositions [set(), set(), {<TrackDisposition.DEFAULT: {'name': 'default', 'index': 0}>}, set(), set()]
|
|
|
|
|
|
|
|
# vs
|
|
|
|
|
|
|
|
# Stream #0:4: Subtitle: ass (ssa) (default)
|
|
|
|
mediaFilePath = createMediaTestFile(mediaDescriptor=sourceMediaDescriptor, directory=self._testDirectory)
|
|
|
|
mediaFilePath = createMediaTestFile(mediaDescriptor=sourceMediaDescriptor, directory=self._testDirectory)
|
|
|
|
|
|
|
|
|
|
|
|
# Phase 2: Prepare database
|
|
|
|
# Phase 2: Prepare database
|
|
|
@ -60,11 +66,14 @@ class Scenario1(Scenario):
|
|
|
|
mediaFilePath,
|
|
|
|
mediaFilePath,
|
|
|
|
'--no-prompt']
|
|
|
|
'--no-prompt']
|
|
|
|
|
|
|
|
|
|
|
|
self._logger.debug(f"Scenario1.run(): sub={trackCombination.getIdentifier()} test sequence: {commandSequence}")
|
|
|
|
if not self._context['use_jellyfin']:
|
|
|
|
|
|
|
|
commandSequence += ['--no-jellyfin']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self._logger.debug(f"Scenario1.run(): sub={trackCombination.getIdentifier()},{combinationIdentifier} test sequence: {commandSequence}")
|
|
|
|
|
|
|
|
|
|
|
|
out, err, rc = executeProcess(commandSequence, directory = self._testDirectory)
|
|
|
|
out, err, rc = executeProcess(commandSequence, directory = self._testDirectory)
|
|
|
|
|
|
|
|
|
|
|
|
self._logger.debug(f"Scenario1.run(): sub={trackCombination.getIdentifier()} process returned: {rc}")
|
|
|
|
self._logger.debug(f"Scenario1.run(): sub={trackCombination.getIdentifier()},{combinationIdentifier} process returned: {rc}")
|
|
|
|
|
|
|
|
|
|
|
|
# if out:
|
|
|
|
# if out:
|
|
|
|
# self._logger.debug(f"Scenario1.run(): process output: {out}")
|
|
|
|
# self._logger.debug(f"Scenario1.run(): process output: {out}")
|
|
|
@ -78,7 +87,8 @@ class Scenario1(Scenario):
|
|
|
|
if rc:
|
|
|
|
if rc:
|
|
|
|
# Stuck with prompt: More than one default subtitle stream detected! Please select stream:
|
|
|
|
# Stuck with prompt: More than one default subtitle stream detected! Please select stream:
|
|
|
|
# TODO: Catch prompt is add option to fail at prompt
|
|
|
|
# TODO: Catch prompt is add option to fail at prompt
|
|
|
|
assert shouldFail, "ffmpeg run didn't fail"
|
|
|
|
assert shouldFail, "ffmpeg run didn't fail" if shouldFail else "ffmpeg run failed"
|
|
|
|
|
|
|
|
self._reportLogger.info(f"Scenario 1 sub={trackCombination.getIdentifier()},{combinationIdentifier} test passed")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
|
|
resultFile = os.path.join(self._testDirectory, 'media.webm')
|
|
|
|
resultFile = os.path.join(self._testDirectory, 'media.webm')
|
|
|
@ -98,14 +108,16 @@ class Scenario1(Scenario):
|
|
|
|
|
|
|
|
|
|
|
|
# assert resultMediaTracks[2].getType() == TrackType.AUDIO, f"Stream #2 is not of type audio"
|
|
|
|
# assert resultMediaTracks[2].getType() == TrackType.AUDIO, f"Stream #2 is not of type audio"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self._logger.debug(f"tgt track dispositions {[d.getDispositionSet() for d in resultMediaDescriptor.getSubtitleTracks()]}")
|
|
|
|
|
|
|
|
|
|
|
|
# assert dispositions
|
|
|
|
# assert dispositions
|
|
|
|
evaluateFunc(resultMediaTracks)
|
|
|
|
evaluateFunc(resultMediaTracks)
|
|
|
|
|
|
|
|
|
|
|
|
self._reportLogger.info(f"Scenario 1 sub={trackCombination.getIdentifier()} test passed")
|
|
|
|
self._reportLogger.info(f"Scenario 1 sub={trackCombination.getIdentifier()},{combinationIdentifier} test passed")
|
|
|
|
|
|
|
|
|
|
|
|
except AssertionError as ae:
|
|
|
|
except AssertionError as ae:
|
|
|
|
|
|
|
|
|
|
|
|
self._reportLogger.error(f"Scenario 1 sub={trackCombination.getIdentifier()} test failed ({ae})")
|
|
|
|
self._reportLogger.error(f"Scenario 1 sub={trackCombination.getIdentifier()},{combinationIdentifier} test failed ({ae})")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|