#398 Default / Forced für unmuxed/imported Streams
This commit is contained in:
@@ -185,9 +185,13 @@ def unmux(ctx,
|
||||
|
||||
if trackDescriptor.getType() == TrackType.SUBTITLE or not subtitles_only:
|
||||
|
||||
# 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}))*'
|
||||
targetPrefix = f"{targetLabel}{targetIndicator}_{trackDescriptor.getIndex()}_{trackDescriptor.getLanguage().threeLetter()}"
|
||||
|
||||
td: TrackDisposition
|
||||
for td in sorted(trackDescriptor.getDispositionSet(), key=lambda d: d.index()):
|
||||
targetPrefix += f"_{td.indicator()}"
|
||||
|
||||
unmuxSequence = getUnmuxSequence(trackDescriptor, sourcePath, targetPrefix, targetDirectory = output_directory)
|
||||
|
||||
if unmuxSequence:
|
||||
|
||||
@@ -31,7 +31,7 @@ class MediaDescriptor:
|
||||
#407 remove as well
|
||||
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'
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
@@ -483,6 +483,16 @@ class MediaDescriptor:
|
||||
subtitleFileDescriptor["index"] = int(sesl_result.group(3))
|
||||
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)
|
||||
|
||||
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']}")
|
||||
matchingSubtitleTrackDescriptor[0].setExternalSourceFilePath(msfd["path"])
|
||||
|
||||
# TODO: Check if useful
|
||||
# matchingSubtitleTrackDescriptor[0].setDispositionSet(msfd["disposition_set"])
|
||||
|
||||
|
||||
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()])}"
|
||||
|
||||
@@ -28,7 +28,7 @@ class TrackCodec(Enum):
|
||||
|
||||
def extension(self):
|
||||
"""Returns the corresponding extension"""
|
||||
return int(self.value['extension'])
|
||||
return str(self.value['extension'])
|
||||
|
||||
@staticmethod
|
||||
def identify(identifier: str):
|
||||
|
||||
@@ -309,6 +309,9 @@ class TrackDescriptor:
|
||||
def getDispositionSet(self):
|
||||
return self.__dispositionSet
|
||||
|
||||
def setDispositionSet(self, dispositionSet: set):
|
||||
self.__dispositionSet = dispositionSet
|
||||
|
||||
def getDispositionFlag(self, disposition: TrackDisposition) -> bool:
|
||||
return bool(disposition in self.__dispositionSet)
|
||||
|
||||
|
||||
@@ -66,3 +66,11 @@ class TrackDisposition(Enum):
|
||||
return matchingDispositions[0]
|
||||
else:
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def fromIndicator(indicator: str):
|
||||
matchingDispositions = [d for d in TrackDisposition if d.indicator() == str(indicator)]
|
||||
if matchingDispositions:
|
||||
return matchingDispositions[0]
|
||||
else:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user