adapt shift output

This commit is contained in:
Javanaut
2026-04-12 20:41:31 +02:00
parent d6e885517d
commit cbf43e5d6c
2 changed files with 13 additions and 3 deletions

View File

@@ -489,6 +489,9 @@ def inspect(ctx, shift, filenames):
episode=episode, episode=episode,
patternId=currentPattern.getId() if currentPattern is not None else None, patternId=currentPattern.getId() if currentPattern is not None else None,
) )
if shiftedSeason == season and shiftedEpisode == episode:
click.echo(f"{filename}: none")
else:
click.echo( click.echo(
f"{filename}: {season}/{episode} -> {shiftedSeason}/{shiftedEpisode} from {sourceLabel}" f"{filename}: {season}/{episode} -> {shiftedSeason}/{shiftedEpisode} from {sourceLabel}"
) )

View File

@@ -70,6 +70,8 @@ class InspectShiftCliTests(unittest.TestCase):
self.source_dir.mkdir() self.source_dir.mkdir()
self.mapped_path = self.source_dir / "mapped.mkv" self.mapped_path = self.source_dir / "mapped.mkv"
self.mapped_path.write_bytes(b"mapped") self.mapped_path.write_bytes(b"mapped")
self.identity_path = self.source_dir / "identity.mkv"
self.identity_path.write_bytes(b"identity")
self.unknown_path = self.source_dir / "unknown.mkv" self.unknown_path = self.source_dir / "unknown.mkv"
self.unknown_path.write_bytes(b"unknown") self.unknown_path.write_bytes(b"unknown")
@@ -94,6 +96,7 @@ class InspectShiftCliTests(unittest.TestCase):
"inspect", "inspect",
"--shift", "--shift",
str(self.mapped_path), str(self.mapped_path),
str(self.identity_path),
str(self.unknown_path), str(self.unknown_path),
], ],
env={**os.environ, "HOME": str(self.home_dir)}, env={**os.environ, "HOME": str(self.home_dir)},
@@ -104,6 +107,10 @@ class InspectShiftCliTests(unittest.TestCase):
f"{self.mapped_path}: 1/3 -> 2/1 from pattern", f"{self.mapped_path}: 1/3 -> 2/1 from pattern",
result.output, result.output,
) )
self.assertIn(
f"{self.identity_path}: none",
result.output,
)
self.assertIn( self.assertIn(
f"{self.unknown_path}: no season/episode recognized", f"{self.unknown_path}: no season/episode recognized",
result.output, result.output,