|
|
@ -31,7 +31,7 @@ class MediaDescriptor:
|
|
|
|
#407 remove as well
|
|
|
|
#407 remove as well
|
|
|
|
EXCLUDED_MEDIA_TAGS = ["creation_time"]
|
|
|
|
EXCLUDED_MEDIA_TAGS = ["creation_time"]
|
|
|
|
|
|
|
|
|
|
|
|
SEASON_EPISODE_STREAM_LANGUAGE_MATCH = '[sS]([0-9]+)[eE]([0-9]+)_([0-9]+)_([a-z]{3})'
|
|
|
|
SEASON_EPISODE_STREAM_LANGUAGE_MATCH = '[sS]([0-9]+)[eE]([0-9]+)_([0-9]+)_([a-z]{3})(?:_([A-Z]{3}))*'
|
|
|
|
SUBTITLE_FILE_EXTENSION = 'vtt'
|
|
|
|
SUBTITLE_FILE_EXTENSION = 'vtt'
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, **kwargs):
|
|
|
|
def __init__(self, **kwargs):
|
|
|
@ -483,6 +483,16 @@ class MediaDescriptor:
|
|
|
|
subtitleFileDescriptor["index"] = int(sesl_result.group(3))
|
|
|
|
subtitleFileDescriptor["index"] = int(sesl_result.group(3))
|
|
|
|
subtitleFileDescriptor["language"] = sesl_result.group(4)
|
|
|
|
subtitleFileDescriptor["language"] = sesl_result.group(4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dispSet = set()
|
|
|
|
|
|
|
|
dispCaptGroups = sesl_result.groups()
|
|
|
|
|
|
|
|
numCaptGroups = len(dispCaptGroups)
|
|
|
|
|
|
|
|
if numCaptGroups > 4:
|
|
|
|
|
|
|
|
for groupIndex in range(numCaptGroups - 4):
|
|
|
|
|
|
|
|
disp = TrackDisposition.fromIndicator(dispCaptGroups[groupIndex + 4])
|
|
|
|
|
|
|
|
if disp is not None:
|
|
|
|
|
|
|
|
dispSet.add(disp)
|
|
|
|
|
|
|
|
subtitleFileDescriptor["disposition_set"] = dispSet
|
|
|
|
|
|
|
|
|
|
|
|
subtitleFileDescriptors.append(subtitleFileDescriptor)
|
|
|
|
subtitleFileDescriptors.append(subtitleFileDescriptor)
|
|
|
|
|
|
|
|
|
|
|
|
self.__logger.debug(f"searchSubtitleFiles(): Available subtitle files {subtitleFileDescriptors}")
|
|
|
|
self.__logger.debug(f"searchSubtitleFiles(): Available subtitle files {subtitleFileDescriptors}")
|
|
|
@ -525,6 +535,9 @@ class MediaDescriptor:
|
|
|
|
self.__logger.debug(f"importSubtitles(): Found matching subtitle file {msfd['path']}")
|
|
|
|
self.__logger.debug(f"importSubtitles(): Found matching subtitle file {msfd['path']}")
|
|
|
|
matchingSubtitleTrackDescriptor[0].setExternalSourceFilePath(msfd["path"])
|
|
|
|
matchingSubtitleTrackDescriptor[0].setExternalSourceFilePath(msfd["path"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: Check if useful
|
|
|
|
|
|
|
|
# matchingSubtitleTrackDescriptor[0].setDispositionSet(msfd["disposition_set"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getConfiguration(self, label: str = ''):
|
|
|
|
def getConfiguration(self, label: str = ''):
|
|
|
|
yield f"--- {label if label else 'MediaDescriptor '+str(id(self))} {' '.join([str(k)+'='+str(v) for k,v in self.__mediaTags.items()])}"
|
|
|
|
yield f"--- {label if label else 'MediaDescriptor '+str(id(self))} {' '.join([str(k)+'='+str(v) for k,v in self.__mediaTags.items()])}"
|
|
|
|