|
|
|
@ -105,8 +105,6 @@ def getUnmuxSequence(trackDescriptor: TrackDescriptor, sourcePath, targetPrefix,
|
|
|
|
|
@click.option("-o", "--output-directory", type=str, default='')
|
|
|
|
|
@click.option("-s", "--subtitles-only", is_flag=True, default=False)
|
|
|
|
|
@click.option("--dry-run", is_flag=True, default=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def unmux(ctx,
|
|
|
|
|
paths,
|
|
|
|
|
label,
|
|
|
|
@ -121,21 +119,27 @@ def unmux(ctx,
|
|
|
|
|
|
|
|
|
|
fp = FileProperties(ctx.obj, sourcePath)
|
|
|
|
|
|
|
|
|
|
print(f"\nFile {sourcePath}\n")
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
sourceMediaDescriptor = fp.getMediaDescriptor()
|
|
|
|
|
|
|
|
|
|
for trackDescriptor in sourceMediaDescriptor.getAllTrackDescriptors():
|
|
|
|
|
|
|
|
|
|
if trackDescriptor.getType() == TrackType.SUBTITLE or not subtitles_only:
|
|
|
|
|
|
|
|
|
|
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():
|
|
|
|
|
|
|
|
|
|
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})'
|
|
|
|
|
targetPrefix = f"{targetLabel}{targetIndicator}_{trackDescriptor.getIndex()}_{trackDescriptor.getLanguage().threeLetter()}"
|
|
|
|
|
|
|
|
|
|