Skip to content

Commit

Permalink
Adds support for moving with original filename (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
queeup committed Mar 6, 2022
1 parent 9f34c79 commit 15ac312
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions mnamer/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Metadata:
quality: Optional[str] = None
synopsis: Optional[str] = None
media: Union[MediaType, str, None] = None
original: Optional[str] = None

def __setattr__(self, key: str, value: Any):
converter_map: Dict[str, Callable] = {
Expand Down
1 change: 1 addition & 0 deletions mnamer/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def _parse(self, file_path: Path):
None: Metadata,
}[media_type]
self.metadata = meta_cls(language=self._settings.language)
self.metadata.original = 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 @@ -217,3 +217,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}'",
".",
)
assert result.code == 0
assert "archer.2009.s10e07.webrip.x264-lucidtv.mp4" in result.out

0 comments on commit 15ac312

Please sign in to comment.