improving unmux
This commit is contained in:
24
bin/ffx.py
24
bin/ffx.py
@@ -105,8 +105,6 @@ def getUnmuxSequence(trackDescriptor: TrackDescriptor, sourcePath, targetPrefix,
|
|||||||
@click.option("-o", "--output-directory", type=str, default='')
|
@click.option("-o", "--output-directory", type=str, default='')
|
||||||
@click.option("-s", "--subtitles-only", is_flag=True, default=False)
|
@click.option("-s", "--subtitles-only", is_flag=True, default=False)
|
||||||
@click.option("--dry-run", is_flag=True, default=False)
|
@click.option("--dry-run", is_flag=True, default=False)
|
||||||
|
|
||||||
|
|
||||||
def unmux(ctx,
|
def unmux(ctx,
|
||||||
paths,
|
paths,
|
||||||
label,
|
label,
|
||||||
@@ -121,21 +119,27 @@ def unmux(ctx,
|
|||||||
|
|
||||||
fp = FileProperties(ctx.obj, sourcePath)
|
fp = FileProperties(ctx.obj, sourcePath)
|
||||||
|
|
||||||
print(f"\nFile {sourcePath}\n")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sourceMediaDescriptor = fp.getMediaDescriptor()
|
sourceMediaDescriptor = fp.getMediaDescriptor()
|
||||||
|
|
||||||
|
season = fp.getSeason()
|
||||||
|
episode = fp.getEpisode()
|
||||||
|
|
||||||
|
#TODO: Recognition für alle Formate anpassen
|
||||||
|
targetLabel = label if label else fp.getFileBasename()
|
||||||
|
targetIndicator = f"_S{season}E{episode}" if label and season != -1 and episode != -1 else ''
|
||||||
|
|
||||||
|
if label and not targetIndicator:
|
||||||
|
click.echo(f"Skipping file {fp.getFilename()}: Label set but no indicator recognized")
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
click.echo(f"\nUnmuxing file {fp.getFilename()}\n")
|
||||||
|
|
||||||
for trackDescriptor in sourceMediaDescriptor.getAllTrackDescriptors():
|
for trackDescriptor in sourceMediaDescriptor.getAllTrackDescriptors():
|
||||||
|
|
||||||
if trackDescriptor.getType() == TrackType.SUBTITLE or not subtitles_only:
|
if trackDescriptor.getType() == TrackType.SUBTITLE or not subtitles_only:
|
||||||
|
|
||||||
season = fp.getSeason()
|
|
||||||
episode = fp.getEpisode()
|
|
||||||
|
|
||||||
targetLabel = label if label else fp.getFileBasename()
|
|
||||||
targetIndicator = f"_S{season}E{episode}" if label and season != -1 and episode != -1 else ''
|
|
||||||
|
|
||||||
# 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})'
|
||||||
targetPrefix = f"{targetLabel}{targetIndicator}_{trackDescriptor.getIndex()}_{trackDescriptor.getLanguage().threeLetter()}"
|
targetPrefix = f"{targetLabel}{targetIndicator}_{trackDescriptor.getIndex()}_{trackDescriptor.getLanguage().threeLetter()}"
|
||||||
|
|
||||||
|
|||||||
@@ -185,9 +185,14 @@ class FileProperties():
|
|||||||
def getEpisode(self):
|
def getEpisode(self):
|
||||||
return int(self.__episode)
|
return int(self.__episode)
|
||||||
|
|
||||||
|
|
||||||
|
def getFilename(self):
|
||||||
|
return self.__sourceFilename
|
||||||
|
|
||||||
def getFileBasename(self):
|
def getFileBasename(self):
|
||||||
return self.__sourceFileBasename
|
return self.__sourceFileBasename
|
||||||
|
|
||||||
|
|
||||||
def assembleTargetFileBasename(self,
|
def assembleTargetFileBasename(self,
|
||||||
label: str = "",
|
label: str = "",
|
||||||
quality: int = -1,
|
quality: int = -1,
|
||||||
|
|||||||
Reference in New Issue
Block a user