From 3ad71dac5d3f5aaa692931904dbbb6316301d36c Mon Sep 17 00:00:00 2001 From: Bugale Bugalit Date: Sun, 1 Sep 2024 23:31:04 +0300 Subject: [PATCH 1/3] fix: support more filenames --- buganime/buganime.py | 8 ++++---- tests/test_buganime.py | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/buganime/buganime.py b/buganime/buganime.py index dc1660f..1d0557e 100644 --- a/buganime/buganime.py +++ b/buganime/buganime.py @@ -109,16 +109,16 @@ def parse_filename(input_path: str) -> TVShow | Movie: if match := re.match(r'^(?P.+?)[ -]+S(?P\d{1,2})E(?P\d{1,3})(?:[ -]+.*)?$', input_name): return TVShow(name=match.group('name'), season=int(match.group('season')), episode=int(match.group('episode'))) - # Other standalone TV Shows - if match := re.match(r'^(?P.+?)[ -]* (?:S(?:eason ?)?(?P\d{1,2})[ -]*)?E?(?P\d{1,3})(?:v\d+)?(?:[ -].*)?$', input_name): - return TVShow(name=match.group('name'), season=int(match.group('season') or '1'), episode=int(match.group('episode'))) - # Structured TV Shows dir_re = r'(?P[^\\]+?)[ -]+S(?:eason ?)?\d{1,2}(?:[ -][^\\]*)?' file_re = r'[^\\]*S(?P\d{1,2})E(?P\d{1,3})(?:[ -][^\\]*)?' if match := re.match(fr'^.*\\{dir_re}(?:\\.*)?\\{file_re}$', input_path): return TVShow(name=match.group('name'), season=int(match.group('season')), episode=int(match.group('episode'))) + # Other standalone TV Shows + if match := re.match(r'^(?P.+?)[ -]* (?:S(?:eason ?)?(?P\d{1,2})[ -]*)?E?(?P\d{1,3})(?:v\d+)?(?:[ -].*)?$', input_name): + return TVShow(name=match.group('name'), season=int(match.group('season') or '1'), episode=int(match.group('episode'))) + return Movie(name=input_name) diff --git a/tests/test_buganime.py b/tests/test_buganime.py index 8dd3be0..355a2be 100644 --- a/tests/test_buganime.py +++ b/tests/test_buganime.py @@ -63,13 +63,17 @@ (r'C:\Monogatari Series\15. Zoku Owarimonogatari\Zoku Owarimonogatari 01 - Koyomi Reverse, Part 1.mkv', buganime.TVShow(name='Zoku Owarimonogatari', season=1, episode=1)), - (r'C:\SNAFU S01-S03+OVA 1080p Dual Audio BDRip 10 bits DD x265-EMBER\SNAFU S02+OVA 1080p Dual Audio BDRip 10 bits DD x265-EMBER\Series\S02E01-Nobody Knows' + (r'C:\SNAFU S01-S03+OVA 1080p Dual Audio BDRip 10 bits DD x265-EMBER\SNAFU S02+OVA 1080p Dual Audio BDRip 10 bits DD x265-EMBER\Series\S02E01-Nobody Knows ' r'Why They Came to the Service Club [7CE95AC0].mkv', buganime.TVShow(name='SNAFU', season=2, episode=1)), (r'C:\Temp\Torrents\SNAFU S01-S03+OVA 1080p Dual Audio BDRip 10 bits DD x265-EMBER\SNAFU S02+OVA 1080p Dual Audio BDRip 10 bits DD x265-EMBER\OVA\S02E14 ' r'[OVA]-Undoubtedly, Girls Are Made of Sugar, Spice, and Everything Nice [7E9E8A1F].mkv', buganime.TVShow(name='SNAFU', season=2, episode=14)), + + (r'C:\Temp\Torrents\Mushoku Tensei S01+SP 1080p Dual Audio BDRip 10 bits DDP x265-EMBER\Mushoku Tensei S01P01 1080p Dual Audio BDRip 10 bits DD ' + r'x265-EMBER\S01E08-Turning Point 1 V2 [87C2150F].mkv', + buganime.TVShow(name='Mushoku Tensei', season=1, episode=8)), ] From 25906249ea6d7c356e5e3b5faa26f947d9fd6d6b Mon Sep 17 00:00:00 2001 From: Bugale Bugalit Date: Sun, 1 Sep 2024 23:44:35 +0300 Subject: [PATCH 2/3] fix: ignore torch warning --- tests/test_buganime.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_buganime.py b/tests/test_buganime.py index 355a2be..49b8082 100644 --- a/tests/test_buganime.py +++ b/tests/test_buganime.py @@ -131,7 +131,8 @@ def test_transcode(filename: str, fps: str, check_func: typing.Callable[[typing. with tempfile.TemporaryDirectory() as tempdir: buganime.OUTPUT_DIR = tempdir output_path = os.path.join(tempdir, 'Movies', filename) - buganime.process_file(os.path.join(os.path.dirname(__file__), 'data', filename)) + with pytest.warns(FutureWarning, match='You are using `torch.load`'): + buganime.process_file(os.path.join(os.path.dirname(__file__), 'data', filename)) assert os.path.isfile(output_path) stream = json.loads(subprocess.run(['ffprobe', '-show_format', '-show_streams', '-of', 'json', output_path], text=True, capture_output=True, check=True, encoding='utf-8').stdout)['streams'][0] From 976570844c774e23d3782a77480d04906a372585 Mon Sep 17 00:00:00 2001 From: Bugale Bugalit Date: Sun, 1 Sep 2024 23:53:51 +0300 Subject: [PATCH 3/3] build: require all checks --- .github/workflows/check-general.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/check-general.yml b/.github/workflows/check-general.yml index 900aec0..a4d80e8 100644 --- a/.github/workflows/check-general.yml +++ b/.github/workflows/check-general.yml @@ -11,9 +11,7 @@ jobs: uses: actions/checkout@v4 - uses: bugale/bugroup-checks@v2 with: - checks: |- - Check .* - .*[lL]int.* + checks: .* self: Required Checks check-commits: name: Check Commits