Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

original_filename support #303

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mnamer/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Metadata:
language_sub: Language | None = None
quality: str | None = None
synopsis: str | None = None
original_filename: str | None = None

@classmethod
def to_media_type(cls) -> MediaType:
Expand Down
2 changes: 1 addition & 1 deletion mnamer/setting_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class SettingStore:
default=False,
metadata=SettingSpec(
action="store_true",
flags=["--test"],
flags=["--test", "--dry-run", "--dryrun"],
group=SettingType.DIRECTIVE,
help="--test: mocks the renaming and moving of files",
).as_dict(),
Expand Down
1 change: 1 addition & 0 deletions mnamer/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def _parse(self, file_path: Path):
None: Metadata,
}[media_type]
self.metadata = meta_cls()
self.metadata.original_filename = self.source.name
self.metadata.quality = (
" ".join(
path_data[key]
Expand Down
12 changes: 12 additions & 0 deletions tests/e2e/test_moving.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,15 @@ def test_ambiguous_language_deletction(e2e_run, setup_test_files):
)
result = e2e_run("--batch", ".")
assert result.code == 0


@pytest.mark.usefixtures("setup_test_dir")
def test_original_filename(e2e_run, setup_test_files):
setup_test_files("archer.2009.s10e07.webrip.x264-lucidtv.mp4")
result = e2e_run(
"--batch",
"--episode-format='{original_filename}'",
".",
)
assert result.code == 0
assert "archer.2009.s10e07.webrip.x264-lucidtv.mp4" in result.out