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 Nov 20, 2020
1 parent 573115f commit 9fb728a
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 @@ -42,6 +42,7 @@ class Metadata:
quality: str = None
synopsis: str = None
media: MediaType = None
original: str = None

def __setattr__(self, key: str, value: Any):
converter = {
Expand Down
1 change: 1 addition & 0 deletions mnamer/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def _parse(self, file_path: PurePath):
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 @@ -215,3 +215,15 @@ def test_ambiguous_language_deletction(e2e_run, setup_test_files):
setup_test_files("Harry Potter and the Sorcerer's Stone 2001 Ultimate Extended Edition 1080p - KRaLiMaRKo.mkv")
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 9fb728a

Please sign in to comment.