Fix test pattern, Test-Limit
This commit is contained in:
@@ -14,6 +14,7 @@ class FileProperties():
|
|||||||
|
|
||||||
FILE_EXTENSIONS = ['mkv', 'mp4', 'avi', 'flv', 'webm']
|
FILE_EXTENSIONS = ['mkv', 'mp4', 'avi', 'flv', 'webm']
|
||||||
|
|
||||||
|
SE_INDICATOR_PATTERN = '([sS][0-9]+[eE][0-9]+)'
|
||||||
SEASON_EPISODE_INDICATOR_MATCH = '[sS]([0-9]+)[eE]([0-9]+)'
|
SEASON_EPISODE_INDICATOR_MATCH = '[sS]([0-9]+)[eE]([0-9]+)'
|
||||||
EPISODE_INDICATOR_MATCH = '[eE]([0-9]+)'
|
EPISODE_INDICATOR_MATCH = '[eE]([0-9]+)'
|
||||||
|
|
||||||
@@ -48,14 +49,18 @@ class FileProperties():
|
|||||||
# Checking if database contains matching pattern
|
# Checking if database contains matching pattern
|
||||||
matchResult = self.__pc.matchFilename(self.__sourceFilename)
|
matchResult = self.__pc.matchFilename(self.__sourceFilename)
|
||||||
|
|
||||||
self.__logger.debug(f"FileProperties.__init__(): Match result {matchResult}")
|
self.__logger.debug(f"FileProperties.__init__(): Match result: {matchResult}")
|
||||||
|
|
||||||
self.__pattern: Pattern = matchResult['pattern'] if matchResult else None
|
self.__pattern: Pattern = matchResult['pattern'] if matchResult else None
|
||||||
|
|
||||||
if matchResult:
|
if matchResult:
|
||||||
databaseMatchedGroups = matchResult['match'].groups()
|
databaseMatchedGroups = matchResult['match'].groups()
|
||||||
self.__season = databaseMatchedGroups[0]
|
self.__logger.debug(f"FileProperties.__init__(): Matched groups: {databaseMatchedGroups}")
|
||||||
self.__episode = databaseMatchedGroups[1]
|
|
||||||
|
seIndicator = databaseMatchedGroups[0]
|
||||||
|
|
||||||
|
se_match = re.search(FileProperties.SEASON_EPISODE_INDICATOR_MATCH, seIndicator)
|
||||||
|
e_match = re.search(FileProperties.EPISODE_INDICATOR_MATCH, seIndicator)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.__logger.debug(f"FileProperties.__init__(): Checking file name for indicator {self.__sourceFilename}")
|
self.__logger.debug(f"FileProperties.__init__(): Checking file name for indicator {self.__sourceFilename}")
|
||||||
@@ -63,15 +68,15 @@ class FileProperties():
|
|||||||
se_match = re.search(FileProperties.SEASON_EPISODE_INDICATOR_MATCH, self.__sourceFilename)
|
se_match = re.search(FileProperties.SEASON_EPISODE_INDICATOR_MATCH, self.__sourceFilename)
|
||||||
e_match = re.search(FileProperties.EPISODE_INDICATOR_MATCH, self.__sourceFilename)
|
e_match = re.search(FileProperties.EPISODE_INDICATOR_MATCH, self.__sourceFilename)
|
||||||
|
|
||||||
if se_match is not None:
|
if se_match is not None:
|
||||||
self.__season = int(se_match.group(1))
|
self.__season = int(se_match.group(1))
|
||||||
self.__episode = int(se_match.group(2))
|
self.__episode = int(se_match.group(2))
|
||||||
elif e_match is not None:
|
elif e_match is not None:
|
||||||
self.__season = -1
|
self.__season = -1
|
||||||
self.__episode = int(e_match.group(1))
|
self.__episode = int(e_match.group(1))
|
||||||
else:
|
else:
|
||||||
self.__season = -1
|
self.__season = -1
|
||||||
self.__episode = -1
|
self.__episode = -1
|
||||||
|
|
||||||
|
|
||||||
def getFormatData(self):
|
def getFormatData(self):
|
||||||
|
|||||||
@@ -419,14 +419,12 @@ class MediaDetailsScreen(Screen):
|
|||||||
|
|
||||||
if event.button.id == "pattern_button":
|
if event.button.id == "pattern_button":
|
||||||
|
|
||||||
INDICATOR_PATTERN = '([sS][0-9]+[eE][0-9]+)'
|
|
||||||
|
|
||||||
pattern = self.query_one("#pattern_input", Input).value
|
pattern = self.query_one("#pattern_input", Input).value
|
||||||
|
|
||||||
patternMatch = re.search(INDICATOR_PATTERN, pattern)
|
patternMatch = re.search(FileProperties.SE_INDICATOR_PATTERN, pattern)
|
||||||
|
|
||||||
if patternMatch:
|
if patternMatch:
|
||||||
self.query_one("#pattern_input", Input).value = pattern.replace(patternMatch.group(1), INDICATOR_PATTERN)
|
self.query_one("#pattern_input", Input).value = pattern.replace(patternMatch.group(1), FileProperties.SE_INDICATOR_PATTERN)
|
||||||
|
|
||||||
|
|
||||||
if event.button.id == "select_default_button":
|
if event.button.id == "select_default_button":
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ from ffx.track_descriptor import TrackDescriptor
|
|||||||
|
|
||||||
from textual.widgets._data_table import CellDoesNotExist
|
from textual.widgets._data_table import CellDoesNotExist
|
||||||
|
|
||||||
|
from ffx.file_properties import FileProperties
|
||||||
|
|
||||||
|
|
||||||
# Screen[dict[int, str, int]]
|
# Screen[dict[int, str, int]]
|
||||||
class PatternDetailsScreen(Screen):
|
class PatternDetailsScreen(Screen):
|
||||||
@@ -387,15 +389,13 @@ class PatternDetailsScreen(Screen):
|
|||||||
|
|
||||||
if event.button.id == "pattern_button":
|
if event.button.id == "pattern_button":
|
||||||
|
|
||||||
INDICATOR_PATTERN = '([sS][0-9]+[eE][0-9]+)'
|
|
||||||
|
|
||||||
pattern = self.query_one("#pattern_input", Input).value
|
pattern = self.query_one("#pattern_input", Input).value
|
||||||
|
|
||||||
patternMatch = re.search(INDICATOR_PATTERN, pattern)
|
patternMatch = re.search(FileProperties.SE_INDICATOR_PATTERN, pattern)
|
||||||
|
|
||||||
if patternMatch:
|
if patternMatch:
|
||||||
self.query_one("#pattern_input", Input).value = pattern.replace(patternMatch.group(1), INDICATOR_PATTERN)
|
self.query_one("#pattern_input", Input).value = pattern.replace(patternMatch.group(1),
|
||||||
|
FileProperties.SE_INDICATOR_PATTERN)
|
||||||
|
|
||||||
def handle_add_track(self, trackDescriptor : TrackDescriptor):
|
def handle_add_track(self, trackDescriptor : TrackDescriptor):
|
||||||
|
|
||||||
|
|||||||
@@ -65,9 +65,12 @@ class Scenario1(Scenario):
|
|||||||
expectedFilename = f"{expectedBasename}.{Scenario1.EXPECTED_FILE_EXTENSION}"
|
expectedFilename = f"{expectedBasename}.{Scenario1.EXPECTED_FILE_EXTENSION}"
|
||||||
|
|
||||||
|
|
||||||
if self._context['test_variant'] and variantIdentifier != self._context['test_variant']:
|
if self._context['test_variant'] and not variantIdentifier.startswith(self._context['test_variant']):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if ((self._context['test_passed_counter'] + self._context['test_failed_counter'])
|
||||||
|
>= self._context['test_limit']):
|
||||||
|
return
|
||||||
|
|
||||||
self._logger.debug(f"Running Job: {variantLabel}")
|
self._logger.debug(f"Running Job: {variantLabel}")
|
||||||
|
|
||||||
@@ -93,9 +96,9 @@ class Scenario1(Scenario):
|
|||||||
commandSequence = [sys.executable,
|
commandSequence = [sys.executable,
|
||||||
self._ffxExecutablePath]
|
self._ffxExecutablePath]
|
||||||
|
|
||||||
# if self._context['verbosity']:
|
if self._context['verbosity']:
|
||||||
# commandSequence += ['--verbose',
|
commandSequence += ['--verbose',
|
||||||
# str(self._context['verbosity'])]
|
str(self._context['verbosity'])]
|
||||||
|
|
||||||
commandSequence += ['convert',
|
commandSequence += ['convert',
|
||||||
mediaFilePath,
|
mediaFilePath,
|
||||||
@@ -116,7 +119,7 @@ class Scenario1(Scenario):
|
|||||||
|
|
||||||
out, err, rc = executeProcess(commandSequence, directory = self._testDirectory)
|
out, err, rc = executeProcess(commandSequence, directory = self._testDirectory)
|
||||||
|
|
||||||
if out:
|
if out and self._context['verbosity'] >= 9:
|
||||||
self._logger.debug(f"{variantLabel}: Process output: {out}")
|
self._logger.debug(f"{variantLabel}: Process output: {out}")
|
||||||
if rc:
|
if rc:
|
||||||
self._logger.debug(f"{variantLabel}: Process returned ERROR {rc} ({err})")
|
self._logger.debug(f"{variantLabel}: Process returned ERROR {rc} ({err})")
|
||||||
|
|||||||
@@ -64,10 +64,13 @@ class Scenario2(Scenario):
|
|||||||
jellyfinSelectorIndex = -1
|
jellyfinSelectorIndex = -1
|
||||||
|
|
||||||
|
|
||||||
#if self._context['test_variant'] and variantIdentifier != self._context['test_variant']:
|
|
||||||
if self._context['test_variant'] and not variantIdentifier.startswith(self._context['test_variant']):
|
if self._context['test_variant'] and not variantIdentifier.startswith(self._context['test_variant']):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if ((self._context['test_passed_counter'] + self._context['test_failed_counter'])
|
||||||
|
>= self._context['test_limit']):
|
||||||
|
return
|
||||||
|
|
||||||
self._logger.debug(f"Running Job: {variantLabel}")
|
self._logger.debug(f"Running Job: {variantLabel}")
|
||||||
|
|
||||||
|
|
||||||
@@ -83,8 +86,13 @@ class Scenario2(Scenario):
|
|||||||
# Phase 2: Run ffx
|
# Phase 2: Run ffx
|
||||||
|
|
||||||
commandSequence = [sys.executable,
|
commandSequence = [sys.executable,
|
||||||
self._ffxExecutablePath,
|
self._ffxExecutablePath]
|
||||||
'convert',
|
|
||||||
|
if self._context['verbosity']:
|
||||||
|
commandSequence += ['--verbose',
|
||||||
|
str(self._context['verbosity'])]
|
||||||
|
|
||||||
|
commandSequence += ['convert',
|
||||||
mediaFilePath,
|
mediaFilePath,
|
||||||
'--no-prompt']
|
'--no-prompt']
|
||||||
|
|
||||||
@@ -96,7 +104,7 @@ class Scenario2(Scenario):
|
|||||||
|
|
||||||
out, err, rc = executeProcess(commandSequence, directory = self._testDirectory)
|
out, err, rc = executeProcess(commandSequence, directory = self._testDirectory)
|
||||||
|
|
||||||
if out:
|
if out and self._context['verbosity'] >= 9:
|
||||||
self._logger.debug(f"{variantLabel}: Process output: {out}")
|
self._logger.debug(f"{variantLabel}: Process output: {out}")
|
||||||
if rc:
|
if rc:
|
||||||
self._logger.debug(f"{variantLabel}: Process returned ERROR {rc} ({err})")
|
self._logger.debug(f"{variantLabel}: Process returned ERROR {rc} ({err})")
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class Scenario4(Scenario):
|
|||||||
TEST_FILE_LABEL = 'rotsh'
|
TEST_FILE_LABEL = 'rotsh'
|
||||||
TEST_FILE_EXTENSION = 'mkv'
|
TEST_FILE_EXTENSION = 'mkv'
|
||||||
|
|
||||||
TEST_PATTERN = f"{TEST_FILE_LABEL}_{FileProperties.SEASON_EPISODE_INDICATOR_MATCH}.{TEST_FILE_EXTENSION}"
|
TEST_PATTERN = f"{TEST_FILE_LABEL}_{FileProperties.SE_INDICATOR_PATTERN}.{TEST_FILE_EXTENSION}"
|
||||||
|
|
||||||
EXPECTED_FILE_EXTENSION = 'webm'
|
EXPECTED_FILE_EXTENSION = 'webm'
|
||||||
|
|
||||||
@@ -118,17 +118,22 @@ class Scenario4(Scenario):
|
|||||||
jellyfinSelectorIndex = -1
|
jellyfinSelectorIndex = -1
|
||||||
|
|
||||||
|
|
||||||
if self._context['test_variant'] and variantIdentifier != self._context['test_variant']:
|
if self._context['test_variant'] and not variantIdentifier.startswith(self._context['test_variant']):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if ((self._context['test_passed_counter'] + self._context['test_failed_counter'])
|
||||||
|
>= self._context['test_limit']):
|
||||||
|
return
|
||||||
|
|
||||||
|
self._logger.debug(f"Running Job: {variantLabel}")
|
||||||
|
|
||||||
|
|
||||||
for l in presetMediaDescriptor.getConfiguration(label = 'presetMediaDescriptor'):
|
for l in presetMediaDescriptor.getConfiguration(label = 'presetMediaDescriptor'):
|
||||||
self._logger.debug(l)
|
self._logger.debug(l)
|
||||||
|
|
||||||
for l in sourceMediaDescriptor.getConfiguration(label = 'sourceMediaDescriptor'):
|
for l in sourceMediaDescriptor.getConfiguration(label = 'sourceMediaDescriptor'):
|
||||||
self._logger.debug(l)
|
self._logger.debug(l)
|
||||||
|
|
||||||
self._logger.debug(f"Running Job: {variantLabel}")
|
|
||||||
|
|
||||||
|
|
||||||
# Phase 1: Setup source files
|
# Phase 1: Setup source files
|
||||||
|
|
||||||
@@ -164,8 +169,13 @@ class Scenario4(Scenario):
|
|||||||
# Phase 3: Run ffx
|
# Phase 3: Run ffx
|
||||||
|
|
||||||
commandSequence = [sys.executable,
|
commandSequence = [sys.executable,
|
||||||
self._ffxExecutablePath,
|
self._ffxExecutablePath]
|
||||||
'--database-file',
|
|
||||||
|
if self._context['verbosity']:
|
||||||
|
commandSequence += ['--verbose',
|
||||||
|
str(self._context['verbosity'])]
|
||||||
|
|
||||||
|
commandSequence += ['--database-file',
|
||||||
self._testDbFilePath,
|
self._testDbFilePath,
|
||||||
'convert']
|
'convert']
|
||||||
commandSequence += [tfo['filename'] for tfo in testFileList]
|
commandSequence += [tfo['filename'] for tfo in testFileList]
|
||||||
@@ -179,8 +189,8 @@ class Scenario4(Scenario):
|
|||||||
|
|
||||||
out, err, rc = executeProcess(commandSequence, directory = self._testDirectory)
|
out, err, rc = executeProcess(commandSequence, directory = self._testDirectory)
|
||||||
|
|
||||||
# if out:
|
if out and self._context['verbosity'] >= 9:
|
||||||
# self._logger.debug(f"{variantLabel}: Process output: {out}")
|
self._logger.debug(f"{variantLabel}: Process output: {out}")
|
||||||
if rc:
|
if rc:
|
||||||
self._logger.debug(f"{variantLabel}: Process returned ERROR {rc} ({err})")
|
self._logger.debug(f"{variantLabel}: Process returned ERROR {rc} ({err})")
|
||||||
|
|
||||||
@@ -258,14 +268,13 @@ class Scenario4(Scenario):
|
|||||||
|
|
||||||
|
|
||||||
self._context['test_passed_counter'] += 1
|
self._context['test_passed_counter'] += 1
|
||||||
self._reportLogger.info(f"{variantLabel}: Test passed")
|
self._reportLogger.info(f"\n{variantLabel}: Test passed\n")
|
||||||
|
|
||||||
except AssertionError as ae:
|
except AssertionError as ae:
|
||||||
|
|
||||||
self._context['test_failed_counter'] += 1
|
self._context['test_failed_counter'] += 1
|
||||||
self._reportLogger.error(f"{variantLabel}: Test FAILED ({ae})")
|
self._reportLogger.error(f"\n{variantLabel}: Test FAILED ({ae})\n")
|
||||||
|
|
||||||
# exit()
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,9 @@ def ffx(ctx, verbose, dry_run):
|
|||||||
@ffx.command()
|
@ffx.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
@click.option('--scenario', type=str, default='', help='Only run tests from this scenario')
|
@click.option('--scenario', type=str, default='', help='Only run tests from this scenario')
|
||||||
@click.option('--variant', type=str, default='', help='Only run this test variant')
|
@click.option('--variant', type=str, default='', help='Only run variants beginning like this')
|
||||||
def run(ctx, scenario, variant):
|
@click.option('--limit', type=int, default=0, help='Only run this number of tests')
|
||||||
|
def run(ctx, scenario, variant, limit):
|
||||||
"""Run ffx test sequences"""
|
"""Run ffx test sequences"""
|
||||||
|
|
||||||
ctx.obj['logger'].info('Starting FFX test runs')
|
ctx.obj['logger'].info('Starting FFX test runs')
|
||||||
@@ -84,6 +85,7 @@ def run(ctx, scenario, variant):
|
|||||||
ctx.obj['test_failed_counter'] = 0
|
ctx.obj['test_failed_counter'] = 0
|
||||||
|
|
||||||
ctx.obj['test_variant'] = variant
|
ctx.obj['test_variant'] = variant
|
||||||
|
ctx.obj['test_limit'] = limit
|
||||||
|
|
||||||
for si in Scenario.list():
|
for si in Scenario.list():
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user