From 004306e4744c757640b276b78325f16641687733 Mon Sep 17 00:00:00 2001 From: Khoa Pham Date: Tue, 17 Dec 2024 02:13:35 +0700 Subject: [PATCH 1/8] Set episode title to empty for SP releases SP releases never have episode title and titles are mistaken as episode title sometimes. --- src/prep.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/prep.py b/src/prep.py index d9c9e2d1..d09dba3f 100644 --- a/src/prep.py +++ b/src/prep.py @@ -697,6 +697,7 @@ async def process_tracker(tracker_name, meta): tracks = meta.get('mediainfo').get('media', {}).get('track', []) # Get all tracks bitrate = tracks[1].get('BitRate', '') if len(tracks) > 1 else '' # Get video bitrate if available bitrate_oldMediaInfo = tracks[0].get('OverallBitRate', '') if len(tracks) > 0 else '' # For old MediaInfo (< 24.x where video bitrate is empty, use 'OverallBitRate' instead) + meta['episode_title'] = "" if (bitrate.isdigit() and int(bitrate) >= 8000000) or (bitrate_oldMediaInfo.isdigit() and int(bitrate_oldMediaInfo) >= 8000000): meta['service'] = "CR" elif (bitrate.isdigit() or bitrate_oldMediaInfo.isdigit()): # Only assign if at least one bitrate is present, otherwise leave it to user From acc8c0314d9fc1dcbafcbb09e8f332bb515cf6a2 Mon Sep 17 00:00:00 2001 From: Audionut Date: Tue, 17 Dec 2024 07:30:40 +1000 Subject: [PATCH 2/8] manual episode title handling --- src/args.py | 3 +++ src/prep.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/args.py b/src/args.py index f51fdfd3..c18a8e68 100644 --- a/src/args.py +++ b/src/args.py @@ -40,6 +40,7 @@ def parse(self, args, meta): parser.add_argument('-edition', '--edition', '--repack', nargs='*', required=False, help="Edition/Repack String e.g.(Director's Cut, Uncut, Hybrid, REPACK, REPACK3)", type=str, dest='manual_edition', default=None) parser.add_argument('-season', '--season', nargs='*', required=False, help="Season (number)", type=str) parser.add_argument('-episode', '--episode', nargs='*', required=False, help="Episode (number)", type=str) + parser.add_argument('-met', '--manual-episode-title', nargs=1, required=False, help="Set episode title, empty = empty", type=datetime.date.fromisoformat, dest="manual_episode_title") parser.add_argument('-daily', '--daily', nargs=1, required=False, help="Air date of this episode (YYYY-MM-DD)", type=datetime.date.fromisoformat, dest="manual_date") parser.add_argument('--no-season', dest='no_season', action='store_true', required=False, help="Remove Season from title") parser.add_argument('--no-year', dest='no_year', action='store_true', required=False, help="Remove Year from title") @@ -242,6 +243,8 @@ def parse(self, args, meta): meta[key] = 100 elif key in ("tag") and value == []: meta[key] = "" + elif key in ["manual_episode_title"]: + meta[key] = value if value else "" else: meta[key] = meta.get(key, None) if key in ('trackers'): diff --git a/src/prep.py b/src/prep.py index d09dba3f..bcc3d75b 100644 --- a/src/prep.py +++ b/src/prep.py @@ -3414,7 +3414,10 @@ async def get_name(self, meta): source = meta.get('source', "") uhd = meta.get('uhd', "") hdr = meta.get('hdr', "") - episode_title = meta.get('episode_title', '') + if meta.get('manual_episode_title'): + episode_title = meta.get('manual_episode_title') + else: + episode_title = meta.get('episode_title', '') if meta.get('is_disc', "") == "BDMV": # Disk video_codec = meta.get('video_codec', "") region = meta.get('region', "") From 8cfdab99857b25befc75742993504b8642a48f08 Mon Sep 17 00:00:00 2001 From: Audionut Date: Tue, 17 Dec 2024 09:04:36 +1000 Subject: [PATCH 3/8] MTV - add imgbb as approved host --- src/trackers/MTV.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/trackers/MTV.py b/src/trackers/MTV.py index 1e569110..92b8011b 100644 --- a/src/trackers/MTV.py +++ b/src/trackers/MTV.py @@ -45,7 +45,7 @@ async def upload(self, meta, disctype): await self.upload_with_retry(meta, cookiefile, common) async def upload_with_retry(self, meta, cookiefile, common, img_host_index=1): - approved_image_hosts = ['ptpimg', 'imgbox'] + approved_image_hosts = ['ptpimg', 'imgbox', 'imgbb'] images_reuploaded = False if all(any(host in image['raw_url'] for host in approved_image_hosts) for image in meta['image_list']): @@ -179,7 +179,7 @@ async def upload_with_retry(self, meta, cookiefile, common, img_host_index=1): async def handle_image_upload(self, meta, img_host_index=1, approved_image_hosts=None, file=None): if approved_image_hosts is None: - approved_image_hosts = ['ptpimg', 'imgbox'] + approved_image_hosts = ['ptpimg', 'imgbox', 'imgbb'] retry_mode = False images_reuploaded = False From 2449e952a84c72de02d1fa3d501e0e01b505e501 Mon Sep 17 00:00:00 2001 From: Audionut Date: Tue, 17 Dec 2024 18:01:26 +1000 Subject: [PATCH 4/8] add nano to docker fixes https://github.com/Audionut/Upload-Assistant/issues/211 --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 3c4ada56..037c52bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ RUN apt-get update && \ mktorrent \ rustc \ mono-complete && \ + nano && \ rm -rf /var/lib/apt/lists/* # Set up a virtual environment to isolate our Python dependencies From 091f8bf4c26cad0ff451750e95e2d16655851e92 Mon Sep 17 00:00:00 2001 From: Audionut Date: Tue, 17 Dec 2024 18:08:01 +1000 Subject: [PATCH 5/8] fix dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 037c52bf..0dfb7af0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get update && \ cargo \ mktorrent \ rustc \ - mono-complete && \ + mono-complete \ nano && \ rm -rf /var/lib/apt/lists/* From ef6aaf6c10c4e59e00a7251c3164f63aea139f6c Mon Sep 17 00:00:00 2001 From: Khoa Pham Date: Tue, 17 Dec 2024 17:54:30 +0700 Subject: [PATCH 6/8] Add -met/--manual-episode-title arg --- src/args.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/args.py b/src/args.py index c18a8e68..cf6b03aa 100644 --- a/src/args.py +++ b/src/args.py @@ -40,7 +40,7 @@ def parse(self, args, meta): parser.add_argument('-edition', '--edition', '--repack', nargs='*', required=False, help="Edition/Repack String e.g.(Director's Cut, Uncut, Hybrid, REPACK, REPACK3)", type=str, dest='manual_edition', default=None) parser.add_argument('-season', '--season', nargs='*', required=False, help="Season (number)", type=str) parser.add_argument('-episode', '--episode', nargs='*', required=False, help="Episode (number)", type=str) - parser.add_argument('-met', '--manual-episode-title', nargs=1, required=False, help="Set episode title, empty = empty", type=datetime.date.fromisoformat, dest="manual_episode_title") + parser.add_argument('-met', '--manual-episode-title', nargs=1, required=False, help="Set episode title, empty = empty", type=str, dest="manual_episode_title") parser.add_argument('-daily', '--daily', nargs=1, required=False, help="Air date of this episode (YYYY-MM-DD)", type=datetime.date.fromisoformat, dest="manual_date") parser.add_argument('--no-season', dest='no_season', action='store_true', required=False, help="Remove Season from title") parser.add_argument('--no-year', dest='no_year', action='store_true', required=False, help="Remove Year from title") @@ -243,8 +243,10 @@ def parse(self, args, meta): meta[key] = 100 elif key in ("tag") and value == []: meta[key] = "" + elif key in ["manual_episode_title"] and value == []: + meta[key] = "" elif key in ["manual_episode_title"]: - meta[key] = value if value else "" + meta[key] = value else: meta[key] = meta.get(key, None) if key in ('trackers'): From 992666242b172f1cd91997525f85f098c5eea20c Mon Sep 17 00:00:00 2001 From: Khoa Pham Date: Tue, 17 Dec 2024 18:02:03 +0700 Subject: [PATCH 7/8] Update prep.py to set manual episode title --- src/prep.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/prep.py b/src/prep.py index bcc3d75b..d9e33b58 100644 --- a/src/prep.py +++ b/src/prep.py @@ -3725,8 +3725,13 @@ async def get_season_episode(self, video, meta): # meta['season'] = "COMPLETE" meta['season_int'] = season_int meta['episode_int'] = episode_int - - meta['episode_title_storage'] = guessit(video, {"excludes": "part"}).get('episode_title', '') + + # Manual episode title + if meta['manual_episode_title'] == "": + meta['episode_title_storage'] = meta.get('manual_episode_title') + else: + meta['episode_title_storage'] = guessit(video, {"excludes": "part"}).get('episode_title', '') + if meta['season'] == "S00" or meta['episode'] == "E00": meta['episode_title'] = meta['episode_title_storage'] From 46ecd9b067073f3d22a38f438556fb85fb2a6127 Mon Sep 17 00:00:00 2001 From: Khoa Pham Date: Tue, 17 Dec 2024 18:03:47 +0700 Subject: [PATCH 8/8] fix whitespace --- src/prep.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/prep.py b/src/prep.py index d9e33b58..437deb0f 100644 --- a/src/prep.py +++ b/src/prep.py @@ -3725,13 +3725,13 @@ async def get_season_episode(self, video, meta): # meta['season'] = "COMPLETE" meta['season_int'] = season_int meta['episode_int'] = episode_int - + # Manual episode title if meta['manual_episode_title'] == "": meta['episode_title_storage'] = meta.get('manual_episode_title') else: meta['episode_title_storage'] = guessit(video, {"excludes": "part"}).get('episode_title', '') - + if meta['season'] == "S00" or meta['episode'] == "E00": meta['episode_title'] = meta['episode_title_storage']