nighl
parent
de0f4a57c1
commit
b9185b5b07
@ -0,0 +1,33 @@
|
|||||||
|
import os, sys, importlib, glob, inspect, itertools
|
||||||
|
|
||||||
|
class BasenameCombinator():
|
||||||
|
|
||||||
|
IDENTIFIER = 'basename'
|
||||||
|
|
||||||
|
def __init__(self, context = None):
|
||||||
|
self._context = context
|
||||||
|
self._logger = context['logger']
|
||||||
|
self._reportLogger = context['report_logger']
|
||||||
|
|
||||||
|
def getIdentifier(self):
|
||||||
|
return BasenameCombinator.IDENTIFIER
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def list():
|
||||||
|
basePath = os.path.dirname(__file__)
|
||||||
|
return [os.path.basename(p)[20:-3]
|
||||||
|
for p
|
||||||
|
in glob.glob(f"{ basePath }/basename_combinator_*.py", recursive = True)
|
||||||
|
if p != __file__]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getClassReference(identifier):
|
||||||
|
importlib.import_module(f"ffx.test.basename_combinator_{ identifier }")
|
||||||
|
for name, obj in inspect.getmembers(sys.modules[f"ffx.test.basename_combinator_{ identifier }"]):
|
||||||
|
#HINT: Excluding MediaCombinator as it seems to be included by import (?)
|
||||||
|
if inspect.isclass(obj) and name != 'BasenameCombinator' and name.startswith('BasenameCombinator'):
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getAllClassReferences():
|
||||||
|
return [BasenameCombinator.getClassReference(i) for i in BasenameCombinator.list()]
|
@ -0,0 +1,84 @@
|
|||||||
|
import os, sys, importlib, glob, inspect, itertools
|
||||||
|
|
||||||
|
from ffx.track_type import TrackType
|
||||||
|
|
||||||
|
from ffx.track_descriptor import TrackDescriptor
|
||||||
|
from ffx.media_descriptor import MediaDescriptor
|
||||||
|
|
||||||
|
from .basename_combinator import BasenameCombinator
|
||||||
|
|
||||||
|
from .indicator_combinator import IndicatorCombinator
|
||||||
|
|
||||||
|
|
||||||
|
class BasenameCombinator0(BasenameCombinator):
|
||||||
|
|
||||||
|
VARIANT = 'B0'
|
||||||
|
|
||||||
|
# def __init__(self, SubCombinators: dict = {}, context = None):
|
||||||
|
def __init__(self, context = None):
|
||||||
|
self._context = context
|
||||||
|
self._logger = context['logger']
|
||||||
|
self._reportLogger = context['report_logger']
|
||||||
|
|
||||||
|
def getVariant(self):
|
||||||
|
return BasenameCombinator0.VARIANT
|
||||||
|
|
||||||
|
def getPayload(self):
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def assertFunc(self, testObj = {}):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def shouldFail(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def getYield(self):
|
||||||
|
|
||||||
|
for MTC in MediaTagCombinator.getAllClassReferences():
|
||||||
|
for DC2_A in DispositionCombinator2.getAllClassReferences():
|
||||||
|
for TC2_A in TrackTagCombinator2.getAllClassReferences():
|
||||||
|
for DC3_S in DispositionCombinator3.getAllClassReferences():
|
||||||
|
for TC3_S in TrackTagCombinator3.getAllClassReferences():
|
||||||
|
for J in JellyfinCombinator.getAllClassReferences():
|
||||||
|
|
||||||
|
j = J(self._context)
|
||||||
|
self._context['use_jellyfin'] = j.getPayload()
|
||||||
|
|
||||||
|
dc2a = DC2_A(self._context)
|
||||||
|
tc2a = TC2_A(self._context)
|
||||||
|
dc3s = DC3_S(self._context)
|
||||||
|
tc3s = TC3_S(self._context)
|
||||||
|
mtc = MTC(self._context)
|
||||||
|
|
||||||
|
yieldObj = {}
|
||||||
|
|
||||||
|
yieldObj['identifier'] = self.getIdentifier()
|
||||||
|
yieldObj['variants'] = [self.getVariant(),
|
||||||
|
f"A:{dc2a.getVariant()}",
|
||||||
|
f"A:{tc2a.getVariant()}",
|
||||||
|
f"S:{dc3s.getVariant()}",
|
||||||
|
f"S:{tc3s.getVariant()}",
|
||||||
|
mtc.getVariant(),
|
||||||
|
j.getVariant()]
|
||||||
|
|
||||||
|
yieldObj['payload'] = self.getPayload(dc2a.getPayload(), tc2a.getPayload(), dc3s.getPayload(), tc3s.getPayload())
|
||||||
|
|
||||||
|
yieldObj['assertSelectors'] = ['M', 'AD', 'AT', 'SD', 'ST', 'MT', 'J']
|
||||||
|
|
||||||
|
yieldObj['assertFuncs'] = [self.assertFunc,
|
||||||
|
dc2a.assertFunc,
|
||||||
|
tc2a.assertFunc,
|
||||||
|
dc3s.assertFunc,
|
||||||
|
tc3s.assertFunc,
|
||||||
|
mtc.assertFunc,
|
||||||
|
j.assertFunc]
|
||||||
|
|
||||||
|
yieldObj['shouldFail'] = (self.shouldFail()
|
||||||
|
| dc2a.shouldFail()
|
||||||
|
| tc2a.shouldFail()
|
||||||
|
| dc3s.shouldFail()
|
||||||
|
| tc3s.shouldFail()
|
||||||
|
| mtc.shouldFail()
|
||||||
|
| j.shouldFail())
|
||||||
|
|
||||||
|
yield yieldObj
|
@ -0,0 +1,90 @@
|
|||||||
|
import os, sys, importlib, glob, inspect, itertools
|
||||||
|
|
||||||
|
from ffx.track_type import TrackType
|
||||||
|
|
||||||
|
from ffx.track_descriptor import TrackDescriptor
|
||||||
|
from ffx.media_descriptor import MediaDescriptor
|
||||||
|
|
||||||
|
from .basename_combinator import BasenameCombinator
|
||||||
|
|
||||||
|
from .indicator_combinator import IndicatorCombinator
|
||||||
|
|
||||||
|
|
||||||
|
class BasenameCombinator1(BasenameCombinator):
|
||||||
|
|
||||||
|
VARIANT = 'B1'
|
||||||
|
|
||||||
|
# def __init__(self, SubCombinators: dict = {}, context = None):
|
||||||
|
def __init__(self, context = None):
|
||||||
|
|
||||||
|
self._context = context
|
||||||
|
self._logger = context['logger']
|
||||||
|
self._reportLogger = context['report_logger']
|
||||||
|
|
||||||
|
# self._SubCombinators = SubCombinations
|
||||||
|
|
||||||
|
def getVariant(self):
|
||||||
|
return BasenameCombinator1.VARIANT
|
||||||
|
|
||||||
|
def getPayload(self):
|
||||||
|
return {'From': 'Encoders'}
|
||||||
|
|
||||||
|
def assertFunc(self, mediaDescriptor: MediaDescriptor):
|
||||||
|
mediaTags = mediaDescriptor.getTags()
|
||||||
|
|
||||||
|
assert 'From' in mediaTags.keys(), "'From' not in media tag keys"
|
||||||
|
assert mediaTags.keys()['From'] == 'Encoders', "Media tag value not 'Encoders' for key 'To'"
|
||||||
|
|
||||||
|
def shouldFail(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def getYield(self):
|
||||||
|
|
||||||
|
for MTC in MediaTagCombinator.getAllClassReferences():
|
||||||
|
for DC2_A in DispositionCombinator2.getAllClassReferences():
|
||||||
|
for TC2_A in TrackTagCombinator2.getAllClassReferences():
|
||||||
|
for DC3_S in DispositionCombinator3.getAllClassReferences():
|
||||||
|
for TC3_S in TrackTagCombinator3.getAllClassReferences():
|
||||||
|
for J in JellyfinCombinator.getAllClassReferences():
|
||||||
|
|
||||||
|
j = J(self._context)
|
||||||
|
self._context['use_jellyfin'] = j.getPayload()
|
||||||
|
|
||||||
|
dc2a = DC2_A(self._context)
|
||||||
|
tc2a = TC2_A(self._context)
|
||||||
|
dc3s = DC3_S(self._context)
|
||||||
|
tc3s = TC3_S(self._context)
|
||||||
|
mtc = MTC(self._context)
|
||||||
|
|
||||||
|
yieldObj = {}
|
||||||
|
|
||||||
|
yieldObj['identifier'] = self.getIdentifier()
|
||||||
|
yieldObj['variants'] = [self.getVariant(),
|
||||||
|
f"A:{dc2a.getVariant()}",
|
||||||
|
f"A:{tc2a.getVariant()}",
|
||||||
|
f"S:{dc3s.getVariant()}",
|
||||||
|
f"S:{tc3s.getVariant()}",
|
||||||
|
mtc.getVariant(),
|
||||||
|
j.getVariant()]
|
||||||
|
|
||||||
|
yieldObj['payload'] = self.getPayload(dc2a.getPayload(), tc2a.getPayload(), dc3s.getPayload(), tc3s.getPayload())
|
||||||
|
|
||||||
|
yieldObj['assertSelectors'] = ['M', 'AD', 'AT', 'SD', 'ST', 'MT', 'J']
|
||||||
|
|
||||||
|
yieldObj['assertFuncs'] = [self.assertFunc,
|
||||||
|
dc2a.assertFunc,
|
||||||
|
tc2a.assertFunc,
|
||||||
|
dc3s.assertFunc,
|
||||||
|
tc3s.assertFunc,
|
||||||
|
mtc.assertFunc,
|
||||||
|
j.assertFunc]
|
||||||
|
|
||||||
|
yieldObj['shouldFail'] = (self.shouldFail()
|
||||||
|
| dc2a.shouldFail()
|
||||||
|
| tc2a.shouldFail()
|
||||||
|
| dc3s.shouldFail()
|
||||||
|
| tc3s.shouldFail()
|
||||||
|
| mtc.shouldFail()
|
||||||
|
| j.shouldFail())
|
||||||
|
|
||||||
|
yield yieldObj
|
@ -0,0 +1,92 @@
|
|||||||
|
import os, sys, importlib, glob, inspect, itertools
|
||||||
|
|
||||||
|
from ffx.track_type import TrackType
|
||||||
|
|
||||||
|
from ffx.track_descriptor import TrackDescriptor
|
||||||
|
from ffx.media_descriptor import MediaDescriptor
|
||||||
|
|
||||||
|
from .basename_combinator import BasenameCombinator
|
||||||
|
|
||||||
|
from .indicator_combinator import IndicatorCombinator
|
||||||
|
from .label_combinator import LabelCombinator
|
||||||
|
|
||||||
|
class BasenameCombinator2(BasenameCombinator):
|
||||||
|
|
||||||
|
VARIANT = 'B2'
|
||||||
|
|
||||||
|
# def __init__(self, SubCombinators: dict = {}, context = None):
|
||||||
|
def __init__(self, context = None):
|
||||||
|
|
||||||
|
self._context = context
|
||||||
|
self._logger = context['logger']
|
||||||
|
self._reportLogger = context['report_logger']
|
||||||
|
|
||||||
|
def getVariant(self):
|
||||||
|
return BasenameCombinator2.VARIANT
|
||||||
|
|
||||||
|
def getPayload(self):
|
||||||
|
return {'To': 'Fanz',
|
||||||
|
'Yolo': 'Holo'}
|
||||||
|
|
||||||
|
def assertFunc(self, mediaDescriptor: MediaDescriptor):
|
||||||
|
mediaTags = mediaDescriptor.getTags()
|
||||||
|
|
||||||
|
assert 'To' in mediaTags.keys(), "'To' not in media tag keys"
|
||||||
|
assert mediaTags.keys()['To'] == 'Fanz', "Media tag value not 'Fanz' for key 'To'"
|
||||||
|
assert 'Yolo' in mediaTags.keys(), "'Yolo' not in media tag keys"
|
||||||
|
assert mediaTags.keys()['Yolo'] == 'Holo', "Media tag value not 'Holo' for key 'Yolo'"
|
||||||
|
|
||||||
|
def shouldFail(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def getYield(self):
|
||||||
|
|
||||||
|
for L in LabelCombinator.getAllClassReferences():
|
||||||
|
for I in IndicatorCombinator.getAllClassReferences():
|
||||||
|
|
||||||
|
for TC2_A in TrackTagCombinator2.getAllClassReferences():
|
||||||
|
for DC3_S in DispositionCombinator3.getAllClassReferences():
|
||||||
|
for TC3_S in TrackTagCombinator3.getAllClassReferences():
|
||||||
|
for J in JellyfinCombinator.getAllClassReferences():
|
||||||
|
|
||||||
|
j = J(self._context)
|
||||||
|
self._context['use_jellyfin'] = j.getPayload()
|
||||||
|
|
||||||
|
dc2a = DC2_A(self._context)
|
||||||
|
tc2a = TC2_A(self._context)
|
||||||
|
dc3s = DC3_S(self._context)
|
||||||
|
tc3s = TC3_S(self._context)
|
||||||
|
mtc = MTC(self._context)
|
||||||
|
|
||||||
|
yieldObj = {}
|
||||||
|
|
||||||
|
yieldObj['identifier'] = self.getIdentifier()
|
||||||
|
yieldObj['variants'] = [self.getVariant(),
|
||||||
|
f"A:{dc2a.getVariant()}",
|
||||||
|
f"A:{tc2a.getVariant()}",
|
||||||
|
f"S:{dc3s.getVariant()}",
|
||||||
|
f"S:{tc3s.getVariant()}",
|
||||||
|
mtc.getVariant(),
|
||||||
|
j.getVariant()]
|
||||||
|
|
||||||
|
yieldObj['payload'] = self.getPayload(dc2a.getPayload(), tc2a.getPayload(), dc3s.getPayload(), tc3s.getPayload())
|
||||||
|
|
||||||
|
yieldObj['assertSelectors'] = ['M', 'AD', 'AT', 'SD', 'ST', 'MT', 'J']
|
||||||
|
|
||||||
|
yieldObj['assertFuncs'] = [self.assertFunc,
|
||||||
|
dc2a.assertFunc,
|
||||||
|
tc2a.assertFunc,
|
||||||
|
dc3s.assertFunc,
|
||||||
|
tc3s.assertFunc,
|
||||||
|
mtc.assertFunc,
|
||||||
|
j.assertFunc]
|
||||||
|
|
||||||
|
yieldObj['shouldFail'] = (self.shouldFail()
|
||||||
|
| dc2a.shouldFail()
|
||||||
|
| tc2a.shouldFail()
|
||||||
|
| dc3s.shouldFail()
|
||||||
|
| tc3s.shouldFail()
|
||||||
|
| mtc.shouldFail()
|
||||||
|
| j.shouldFail())
|
||||||
|
|
||||||
|
yield yieldObj
|
@ -0,0 +1,26 @@
|
|||||||
|
class IndicatorCombinator():
|
||||||
|
|
||||||
|
IDENTIFIER = 'indicator'
|
||||||
|
|
||||||
|
MAX_SEASON = 3
|
||||||
|
MAX_EPISODE = 3
|
||||||
|
|
||||||
|
def __init__(self, context = None):
|
||||||
|
self._context = context
|
||||||
|
self._logger = context['logger']
|
||||||
|
self._reportLogger = context['report_logger']
|
||||||
|
|
||||||
|
def getIdentifier(self):
|
||||||
|
return IndicatorCombinator.IDENTIFIER
|
||||||
|
|
||||||
|
def assertFunc(self, testObj = {}):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def shouldFail(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def getYield(self):
|
||||||
|
|
||||||
|
for season in range(IndicatorCombinator.MAX_SEASON):
|
||||||
|
for episode in range(IndicatorCombinator.MAX_EPISODE):
|
||||||
|
yield f"S{season+1:02d}E{episode+1:02d}"
|
@ -0,0 +1,36 @@
|
|||||||
|
import os, sys, importlib, glob, inspect, itertools
|
||||||
|
|
||||||
|
class LabelCombinator():
|
||||||
|
|
||||||
|
IDENTIFIER = 'label'
|
||||||
|
PREFIX = 'label_combinator_'
|
||||||
|
|
||||||
|
LABEL = 'media'
|
||||||
|
|
||||||
|
def __init__(self, context = None):
|
||||||
|
self._context = context
|
||||||
|
self._logger = context['logger']
|
||||||
|
self._reportLogger = context['report_logger']
|
||||||
|
|
||||||
|
def getIdentifier(self):
|
||||||
|
return LabelCombinator.IDENTIFIER
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def list():
|
||||||
|
basePath = os.path.dirname(__file__)
|
||||||
|
return [os.path.basename(p)[len(LabelCombinator.PREFIX):-3]
|
||||||
|
for p
|
||||||
|
in glob.glob(f"{ basePath }/{LabelCombinator.PREFIX}*.py", recursive = True)
|
||||||
|
if p != __file__]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getClassReference(identifier):
|
||||||
|
importlib.import_module(f"ffx.test.{LabelCombinator.PREFIX}{ identifier }")
|
||||||
|
for name, obj in inspect.getmembers(sys.modules[f"ffx.test.{LabelCombinator.PREFIX}{ identifier }"]):
|
||||||
|
#HINT: Excluding MediaCombinator as it seems to be included by import (?)
|
||||||
|
if inspect.isclass(obj) and name != 'LabelCombinator' and name.startswith('LabelCombinator'):
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getAllClassReferences():
|
||||||
|
return [LabelCombinator.getClassReference(i) for i in LabelCombinator.list()]
|
@ -0,0 +1,30 @@
|
|||||||
|
import os, sys, importlib, glob, inspect, itertools
|
||||||
|
|
||||||
|
from ffx.track_type import TrackType
|
||||||
|
|
||||||
|
from ffx.track_descriptor import TrackDescriptor
|
||||||
|
from ffx.media_descriptor import MediaDescriptor
|
||||||
|
|
||||||
|
from .label_combinator import LabelCombinator
|
||||||
|
|
||||||
|
|
||||||
|
class LabelCombinator0(LabelCombinator):
|
||||||
|
|
||||||
|
VARIANT = 'L0'
|
||||||
|
|
||||||
|
def __init__(self, context = None):
|
||||||
|
self._context = context
|
||||||
|
self._logger = context['logger']
|
||||||
|
self._reportLogger = context['report_logger']
|
||||||
|
|
||||||
|
def getVariant(self):
|
||||||
|
return LabelCombinator0.VARIANT
|
||||||
|
|
||||||
|
def getPayload(self):
|
||||||
|
return ''
|
||||||
|
|
||||||
|
def assertFunc(self, testObj = {}):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def shouldFail(self):
|
||||||
|
return False
|
@ -0,0 +1,30 @@
|
|||||||
|
import os, sys, importlib, glob, inspect, itertools
|
||||||
|
|
||||||
|
from ffx.track_type import TrackType
|
||||||
|
|
||||||
|
from ffx.track_descriptor import TrackDescriptor
|
||||||
|
from ffx.media_descriptor import MediaDescriptor
|
||||||
|
|
||||||
|
from .label_combinator import LabelCombinator
|
||||||
|
|
||||||
|
class LabelCombinator1(LabelCombinator):
|
||||||
|
|
||||||
|
VARIANT = 'L1'
|
||||||
|
|
||||||
|
def __init__(self, context = None):
|
||||||
|
|
||||||
|
self._context = context
|
||||||
|
self._logger = context['logger']
|
||||||
|
self._reportLogger = context['report_logger']
|
||||||
|
|
||||||
|
def getVariant(self):
|
||||||
|
return LabelCombinator1.VARIANT
|
||||||
|
|
||||||
|
def getPayload(self):
|
||||||
|
return LabelCombinator.LABEL
|
||||||
|
|
||||||
|
def assertFunc(self, testObj = {}):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def shouldFail(self):
|
||||||
|
return False
|
@ -0,0 +1,34 @@
|
|||||||
|
class SiteCombinator():
|
||||||
|
|
||||||
|
IDENTIFIER = 'site'
|
||||||
|
|
||||||
|
SITE_LIST = [
|
||||||
|
".GerEngSub.AAC.1080pINDICATOR.WebDL.x264-Tanuki",
|
||||||
|
".German.AC3.DL.1080pINDICATOR.BluRay.x264-AST4u",
|
||||||
|
"-720pINDICATOR"
|
||||||
|
]
|
||||||
|
|
||||||
|
def __init__(self, context = None, indicator = ''):
|
||||||
|
self._context = context
|
||||||
|
self._logger = context['logger']
|
||||||
|
self._reportLogger = context['report_logger']
|
||||||
|
|
||||||
|
self.__indicator = indicator
|
||||||
|
|
||||||
|
def getIdentifier(self):
|
||||||
|
return SiteCombinator.IDENTIFIER
|
||||||
|
|
||||||
|
def getPayload(self, index):
|
||||||
|
site = SiteCombinator.SITE_LIST[index]
|
||||||
|
return site.replace('INDICATOR', f".{self.__indicator}") if self.__indicator else site.replace('INDICATOR', '')
|
||||||
|
|
||||||
|
def assertFunc(self, testObj = {}):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def shouldFail(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def getYield(self):
|
||||||
|
|
||||||
|
for titleIndex in len(SiteCombinator.SITE_LIST):
|
||||||
|
yield self.getPayload(titleIndex)
|
@ -0,0 +1,28 @@
|
|||||||
|
class TitleCombinator():
|
||||||
|
|
||||||
|
IDENTIFIER = 'title'
|
||||||
|
|
||||||
|
TITLE_LIST = [
|
||||||
|
'The Sound of Space',
|
||||||
|
' 2001: Odyssee im Weltraum (1968)',
|
||||||
|
'Ansible 101'
|
||||||
|
]
|
||||||
|
|
||||||
|
def __init__(self, context = None):
|
||||||
|
self._context = context
|
||||||
|
self._logger = context['logger']
|
||||||
|
self._reportLogger = context['report_logger']
|
||||||
|
|
||||||
|
def getIdentifier(self):
|
||||||
|
return TitleCombinator.IDENTIFIER
|
||||||
|
|
||||||
|
def assertFunc(self, testObj = {}):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def shouldFail(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def getYield(self):
|
||||||
|
|
||||||
|
for title in TitleCombinator.TITLE_LIST:
|
||||||
|
yield title
|
Loading…
Reference in New Issue