From 858b8e66618fdb86f91dbadddfa74c0f96fe5fb5 Mon Sep 17 00:00:00 2001 From: tiberio87 Date: Tue, 27 Aug 2024 08:54:21 +0200 Subject: [PATCH 1/6] add SHRI tracker --- data/example-config.py | 5 ++ src/trackers/SHRI.py | 179 +++++++++++++++++++++++++++++++++++++++++ upload.py | 5 +- 3 files changed, 187 insertions(+), 2 deletions(-) create mode 100644 src/trackers/SHRI.py diff --git a/data/example-config.py b/data/example-config.py index 7b8a0d082..6b6f2bbec 100644 --- a/data/example-config.py +++ b/data/example-config.py @@ -214,6 +214,11 @@ "announce_url" : "https://UTP/announce/customannounceurl", # "anon" : False }, + "SHRI" :{ + "api_key" : "SHRI api key", + "announce_url" : "https://shareisland.org/announce/customannounceurl", + # "anon" : "False" + }, "MANUAL" : { # Uncomment and replace link with filebrowser (https://github.com/filebrowser/filebrowser) link to the Upload-Assistant directory, this will link to your filebrowser instead of uploading to uguu.se # "filebrowser" : "https://domain.tld/filebrowser/files/Upload-Assistant/" diff --git a/src/trackers/SHRI.py b/src/trackers/SHRI.py new file mode 100644 index 000000000..47fe6d614 --- /dev/null +++ b/src/trackers/SHRI.py @@ -0,0 +1,179 @@ +# -*- coding: utf-8 -*- +# import discord +import asyncio +import requests +from str2bool import str2bool +import os +import platform + +from src.trackers.COMMON import COMMON +from src.console import console + + +class SHRI(): + """ + Edit for Tracker: + Edit BASE.torrent with announce and source + Check for duplicates + Set type/category IDs + Upload + """ + + ############################################################### + ######## EDIT ME ######## + ############################################################### + + # ALSO EDIT CLASS NAME ABOVE + + def __init__(self, config): + self.config = config + self.tracker = 'SHRI' + self.source_flag = 'Shareisland' + self.upload_url = 'https://shareisland.org/api/torrents/upload' + self.search_url = 'https://shareisland.org/api/torrents/filter' + self.signature = f"\n[center][url=https://shareisland.org]Created by SHRI Upload Assistant[/url][/center]" + self.banned_groups = [""] + pass + + async def get_cat_id(self, category_name): + category_id = { + 'MOVIE': '1', + 'TV': '2', + }.get(category_name, '0') + return category_id + + async def get_type_id(self, type): + type_id = { + 'DISC': '26', + 'REMUX': '7', + 'WEBDL': '27', + 'WEBRIP': '27', + 'HDTV': '6', + 'ENCODE': '15' + }.get(type, '0') + return type_id + + async def get_res_id(self, resolution): + resolution_id = { + '8640p':'10', + '4320p': '1', + '2160p': '2', + '1440p' : '3', + '1080p': '3', + '1080i':'4', + '720p': '5', + '576p': '6', + '576i': '7', + '480p': '8', + '480i': '9' + }.get(resolution, '10') + return resolution_id + + ############################################################### + ###### STOP HERE UNLESS EXTRA MODIFICATION IS NEEDED ###### + ############################################################### + + async def upload(self, meta): + common = COMMON(config=self.config) + await common.edit_torrent(meta, self.tracker, self.source_flag) + cat_id = await self.get_cat_id(meta['category']) + type_id = await self.get_type_id(meta['type']) + resolution_id = await self.get_res_id(meta['resolution']) + await common.unit3d_edit_desc(meta, self.tracker, self.signature) + region_id = await common.unit3d_region_ids(meta.get('region')) + distributor_id = await common.unit3d_distributor_ids(meta.get('distributor')) + if meta['anon'] == 0 and bool(str2bool(str(self.config['TRACKERS'][self.tracker].get('anon', "False")))) == False: + anon = 0 + else: + anon = 1 + + if meta['bdinfo'] != None: + mi_dump = None + bd_dump = open(f"{meta['base_dir']}/tmp/{meta['uuid']}/BD_SUMMARY_00.txt", 'r', encoding='utf-8').read() + else: + mi_dump = open(f"{meta['base_dir']}/tmp/{meta['uuid']}/MEDIAINFO.txt", 'r', encoding='utf-8').read() + bd_dump = None + desc = open(f"{meta['base_dir']}/tmp/{meta['uuid']}/[{self.tracker}]DESCRIPTION.txt", 'r').read() + open_torrent = open(f"{meta['base_dir']}/tmp/{meta['uuid']}/[{self.tracker}]{meta['clean_name']}.torrent", 'rb') + files = {'torrent': open_torrent} + data = { + 'name' : meta['name'], + 'description' : desc, + 'mediainfo' : mi_dump, + 'bdinfo' : bd_dump, + 'category_id' : cat_id, + 'type_id' : type_id, + 'resolution_id' : resolution_id, + 'tmdb' : meta['tmdb'], + 'imdb' : meta['imdb_id'].replace('tt', ''), + 'tvdb' : meta['tvdb_id'], + 'mal' : meta['mal_id'], + 'igdb' : 0, + 'anonymous' : anon, + 'stream' : meta['stream'], + 'sd' : meta['sd'], + 'keywords' : meta['keywords'], + 'personal_release' : int(meta.get('personalrelease', False)), + 'internal' : 0, + 'featured' : 0, + 'free' : 0, + 'doubleup' : 0, + 'sticky' : 0, + } + # Internal + if self.config['TRACKERS'][self.tracker].get('internal', False) == True: + if meta['tag'] != "" and (meta['tag'][1:] in self.config['TRACKERS'][self.tracker].get('internal_groups', [])): + data['internal'] = 1 + + if region_id != 0: + data['region_id'] = region_id + if distributor_id != 0: + data['distributor_id'] = distributor_id + if meta.get('category') == "TV": + data['season_number'] = meta.get('season_int', '0') + data['episode_number'] = meta.get('episode_int', '0') + headers = { + 'User-Agent': f'Upload Assistant/2.1 ({platform.system()} {platform.release()})' + } + params = { + 'api_token' : self.config['TRACKERS'][self.tracker]['api_key'].strip() + } + + if meta['debug'] == False: + response = requests.post(url=self.upload_url, files=files, data=data, headers=headers, params=params) + try: + console.print(response.json()) + except: + console.print("It may have uploaded, go check") + return + else: + console.print(f"[cyan]Request Data:") + console.print(data) + open_torrent.close() + + async def search_existing(self, meta): + dupes = [] + console.print("[yellow]Searching for existing torrents on site...") + params = { + 'api_token' : self.config['TRACKERS'][self.tracker]['api_key'].strip(), + 'tmdbId' : meta['tmdb'], + 'categories[]' : await self.get_cat_id(meta['category']), + 'types[]' : await self.get_type_id(meta['type']), + 'resolutions[]' : await self.get_res_id(meta['resolution']), + 'name' : "" + } + if meta.get('edition', "") != "": + params['name'] = params['name'] + f" {meta['edition']}" + try: + response = requests.get(url=self.search_url, params=params) + response = response.json() + for each in response['data']: + result = [each][0]['attributes']['name'] + # difference = SequenceMatcher(None, meta['clean_name'], result).ratio() + # if difference >= 0.05: + dupes.append(result) + except: + console.print('[bold red]Unable to search for existing torrents on site. Either the site is down or your API key is incorrect') + await asyncio.sleep(5) + + return dupes \ No newline at end of file diff --git a/upload.py b/upload.py index 2ef0f1d55..9aebc13b4 100644 --- a/upload.py +++ b/upload.py @@ -37,6 +37,7 @@ from src.trackers.FNP import FNP from src.trackers.CBR import CBR from src.trackers.UTP import UTP +from src.trackers.SHRI import SHRI import json from pathlib import Path import asyncio @@ -247,12 +248,12 @@ async def do_the_thing(base_dir): ####### Upload to Trackers ####### #################################### common = COMMON(config=config) - api_trackers = ['BLU', 'AITHER', 'STC', 'R4E', 'STT', 'RF', 'ACM','LCD','LST','HUNO', 'SN', 'LT', 'NBL', 'ANT', 'JPTV', 'TDC', 'OE', 'BHDTV', 'RTF', 'OTW', 'FNP', 'CBR', 'UTP'] + api_trackers = ['BLU', 'AITHER', 'STC', 'R4E', 'STT', 'RF', 'ACM','LCD','LST','HUNO', 'SN', 'LT', 'NBL', 'ANT', 'JPTV', 'TDC', 'OE', 'BHDTV', 'RTF', 'OTW', 'FNP', 'CBR', 'UTP','SHRI'] http_trackers = ['HDB', 'TTG', 'FL', 'PTER', 'HDT', 'MTV'] tracker_class_map = { 'BLU' : BLU, 'BHD': BHD, 'AITHER' : AITHER, 'STC' : STC, 'R4E' : R4E, 'THR' : THR, 'STT' : STT, 'HP' : HP, 'PTP' : PTP, 'RF' : RF, 'SN' : SN, 'ACM' : ACM, 'HDB' : HDB, 'LCD': LCD, 'TTG' : TTG, 'LST' : LST, 'HUNO': HUNO, 'FL' : FL, 'LT' : LT, 'NBL' : NBL, 'ANT' : ANT, 'PTER': PTER, 'JPTV' : JPTV, - 'TL' : TL, 'TDC' : TDC, 'HDT' : HDT, 'MTV': MTV, 'OE': OE, 'BHDTV': BHDTV, 'RTF':RTF, 'OTW': OTW, 'FNP': FNP, 'CBR': CBR, 'UTP': UTP} + 'TL' : TL, 'TDC' : TDC, 'HDT' : HDT, 'MTV': MTV, 'OE': OE, 'BHDTV': BHDTV, 'RTF':RTF, 'OTW': OTW, 'FNP': FNP, 'CBR': CBR, 'UTP': UTP, 'SHRI': SHRI} for tracker in trackers: if meta['name'].endswith('DUPE?'): From fe21811c0a74d094ec51be19117b03c19605fc4e Mon Sep 17 00:00:00 2001 From: tiberio87 Date: Tue, 27 Aug 2024 11:00:05 +0200 Subject: [PATCH 2/6] add SHRI tracker --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 076b66d09..4f32372b0 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ A simple tool to take the work out of uploading. - Can re-use existing torrents instead of hashing new - Generates proper name for your upload using Mediainfo/BDInfo and TMDb/IMDb conforming to site rules - Checks for existing releases already on site - - Uploads to PTP/BLU/BHD/Aither/THR/STC/R4E(limited)/STT/HP/ACM/LCD/LST/NBL/ANT/FL/HUNO/RF/SN/RTF/OTW/FNP/CBR/UTP + - Uploads to PTP/BLU/BHD/Aither/THR/STC/R4E(limited)/STT/HP/ACM/LCD/LST/NBL/ANT/FL/HUNO/RF/SN/RTF/OTW/FNP/CBR/UTP/SHRI - Adds to your client with fast resume, seeding instantly (rtorrent/qbittorrent/deluge/watch folder) - ALL WITH MINIMAL INPUT! - Currently works with .mkv/.mp4/Blu-ray/DVD/HD-DVDs From 4e508c04981b9b7980e2a7fa2df058f53a19eb77 Mon Sep 17 00:00:00 2001 From: Tiberio <90521592+tiberio87@users.noreply.github.com> Date: Sun, 1 Sep 2024 12:10:15 +0200 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f32372b0..b163b3707 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ A simple tool to take the work out of uploading. - Can re-use existing torrents instead of hashing new - Generates proper name for your upload using Mediainfo/BDInfo and TMDb/IMDb conforming to site rules - Checks for existing releases already on site - - Uploads to PTP/BLU/BHD/Aither/THR/STC/R4E(limited)/STT/HP/ACM/LCD/LST/NBL/ANT/FL/HUNO/RF/SN/RTF/OTW/FNP/CBR/UTP/SHRI + - Uploads to PTP/BLU/BHD/Aither/THR/STC/R4E(limited)/STT/HP/ACM/LCD/LST/NBL/ANT/FL/HUNO/RF/SN/RTF/OTW/FNP/CBR/UTP/HDB/AL/SHRI - Adds to your client with fast resume, seeding instantly (rtorrent/qbittorrent/deluge/watch folder) - ALL WITH MINIMAL INPUT! - Currently works with .mkv/.mp4/Blu-ray/DVD/HD-DVDs From 5f88767be6b165c3c2972daa7014925039d666d1 Mon Sep 17 00:00:00 2001 From: Tiberio <90521592+tiberio87@users.noreply.github.com> Date: Sun, 1 Sep 2024 12:13:19 +0200 Subject: [PATCH 4/6] Update example-config.py --- data/example-config.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/data/example-config.py b/data/example-config.py index 6b6f2bbec..fede8f8b5 100644 --- a/data/example-config.py +++ b/data/example-config.py @@ -214,6 +214,18 @@ "announce_url" : "https://UTP/announce/customannounceurl", # "anon" : False }, + "AL": { + "api_key": "AL api key", + "announce_url": "https://animelovers.club/announce/customannounceurl", + # "anon" : False + }, + "HDB": { + "useAPI": True, + "username": "HDB username", + "passkey": "HDB passkey", + "announce_url": "https://hdbits.org/announce/Custom_Announce_URL", + "anon": False, + }, "SHRI" :{ "api_key" : "SHRI api key", "announce_url" : "https://shareisland.org/announce/customannounceurl", From add55a8db28623e729e7d1d5f6381a437ff1a082 Mon Sep 17 00:00:00 2001 From: Tiberio <90521592+tiberio87@users.noreply.github.com> Date: Sun, 1 Sep 2024 12:18:05 +0200 Subject: [PATCH 5/6] Update upload.py --- upload.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/upload.py b/upload.py index 9aebc13b4..3d94576fc 100644 --- a/upload.py +++ b/upload.py @@ -37,6 +37,7 @@ from src.trackers.FNP import FNP from src.trackers.CBR import CBR from src.trackers.UTP import UTP +from src.trackers.AL import AL from src.trackers.SHRI import SHRI import json from pathlib import Path @@ -248,12 +249,12 @@ async def do_the_thing(base_dir): ####### Upload to Trackers ####### #################################### common = COMMON(config=config) - api_trackers = ['BLU', 'AITHER', 'STC', 'R4E', 'STT', 'RF', 'ACM','LCD','LST','HUNO', 'SN', 'LT', 'NBL', 'ANT', 'JPTV', 'TDC', 'OE', 'BHDTV', 'RTF', 'OTW', 'FNP', 'CBR', 'UTP','SHRI'] + api_trackers = ['BLU', 'AITHER', 'STC', 'R4E', 'STT', 'RF', 'ACM','LCD','LST','HUNO', 'SN', 'LT', 'NBL', 'ANT', 'JPTV', 'TDC', 'OE', 'BHDTV', 'RTF', 'OTW', 'FNP', 'CBR', 'UTP','AL', 'HDB', 'SHRI'] http_trackers = ['HDB', 'TTG', 'FL', 'PTER', 'HDT', 'MTV'] tracker_class_map = { 'BLU' : BLU, 'BHD': BHD, 'AITHER' : AITHER, 'STC' : STC, 'R4E' : R4E, 'THR' : THR, 'STT' : STT, 'HP' : HP, 'PTP' : PTP, 'RF' : RF, 'SN' : SN, 'ACM' : ACM, 'HDB' : HDB, 'LCD': LCD, 'TTG' : TTG, 'LST' : LST, 'HUNO': HUNO, 'FL' : FL, 'LT' : LT, 'NBL' : NBL, 'ANT' : ANT, 'PTER': PTER, 'JPTV' : JPTV, - 'TL' : TL, 'TDC' : TDC, 'HDT' : HDT, 'MTV': MTV, 'OE': OE, 'BHDTV': BHDTV, 'RTF':RTF, 'OTW': OTW, 'FNP': FNP, 'CBR': CBR, 'UTP': UTP, 'SHRI': SHRI} + 'TL' : TL, 'TDC' : TDC, 'HDT' : HDT, 'MTV': MTV, 'OE': OE, 'BHDTV': BHDTV, 'RTF':RTF, 'OTW': OTW, 'FNP': FNP, 'CBR': CBR, 'UTP': UTP, 'AL': AL, 'SHRI': SHRI} for tracker in trackers: if meta['name'].endswith('DUPE?'): @@ -586,4 +587,4 @@ def get_missing(meta): loop = asyncio.get_event_loop() loop.run_until_complete(do_the_thing(base_dir)) else: - asyncio.run(do_the_thing(base_dir)) \ No newline at end of file + asyncio.run(do_the_thing(base_dir)) From dcdc6280afc95e161b9b734c0dfd48291ebc18d2 Mon Sep 17 00:00:00 2001 From: Audionut Date: Mon, 2 Sep 2024 09:26:14 +1000 Subject: [PATCH 6/6] Lint cleaning --- data/example-config.py | 12 ++-- src/trackers/SHRI.py | 121 ++++++++++++++++++++--------------------- upload.py | 12 ++-- 3 files changed, 72 insertions(+), 73 deletions(-) diff --git a/data/example-config.py b/data/example-config.py index db8ef0c7b..dfbb6a011 100644 --- a/data/example-config.py +++ b/data/example-config.py @@ -225,13 +225,13 @@ "passkey": "HDB passkey", "announce_url": "https://hdbits.org/announce/Custom_Announce_URL", "anon": False, - }, - "SHRI" :{ - "api_key" : "SHRI api key", - "announce_url" : "https://shareisland.org/announce/customannounceurl", + }, + "SHRI": { + "api_key": "SHRI api key", + "announce_url": "https://shareisland.org/announce/customannounceurl", # "anon" : "False" - }, - "MANUAL" : { + }, + "MANUAL": { # Uncomment and replace link with filebrowser (https://github.com/filebrowser/filebrowser) link to the Upload-Assistant directory, this will link to your filebrowser instead of uploading to uguu.se # "filebrowser" : "https://domain.tld/filebrowser/files/Upload-Assistant/" }, diff --git a/src/trackers/SHRI.py b/src/trackers/SHRI.py index 47fe6d614..689bfc62e 100644 --- a/src/trackers/SHRI.py +++ b/src/trackers/SHRI.py @@ -3,7 +3,6 @@ import asyncio import requests from str2bool import str2bool -import os import platform from src.trackers.COMMON import COMMON @@ -20,7 +19,7 @@ class SHRI(): """ ############################################################### - ######## EDIT ME ######## + ######## EDIT ME ######## # noqa #E266 ############################################################### # ALSO EDIT CLASS NAME ABOVE @@ -31,46 +30,46 @@ def __init__(self, config): self.source_flag = 'Shareisland' self.upload_url = 'https://shareisland.org/api/torrents/upload' self.search_url = 'https://shareisland.org/api/torrents/filter' - self.signature = f"\n[center][url=https://shareisland.org]Created by SHRI Upload Assistant[/url][/center]" + self.signature = "\n[center][url=https://shareisland.org]Created by SHRI Upload Assistant[/url][/center]" self.banned_groups = [""] pass - + async def get_cat_id(self, category_name): category_id = { - 'MOVIE': '1', - 'TV': '2', - }.get(category_name, '0') + 'MOVIE': '1', + 'TV': '2', + }.get(category_name, '0') return category_id async def get_type_id(self, type): type_id = { - 'DISC': '26', + 'DISC': '26', 'REMUX': '7', - 'WEBDL': '27', - 'WEBRIP': '27', + 'WEBDL': '27', + 'WEBRIP': '27', 'HDTV': '6', 'ENCODE': '15' - }.get(type, '0') + }.get(type, '0') return type_id async def get_res_id(self, resolution): resolution_id = { - '8640p':'10', - '4320p': '1', - '2160p': '2', - '1440p' : '3', + '8640p': '10', + '4320p': '1', + '2160p': '2', + '1440p': '3', '1080p': '3', - '1080i':'4', - '720p': '5', - '576p': '6', + '1080i': '4', + '720p': '5', + '576p': '6', '576i': '7', - '480p': '8', + '480p': '8', '480i': '9' - }.get(resolution, '10') + }.get(resolution, '10') return resolution_id ############################################################### - ###### STOP HERE UNLESS EXTRA MODIFICATION IS NEEDED ###### + ###### STOP HERE UNLESS EXTRA MODIFICATION IS NEEDED ###### # noqa #E266 ############################################################### async def upload(self, meta): @@ -82,12 +81,12 @@ async def upload(self, meta): await common.unit3d_edit_desc(meta, self.tracker, self.signature) region_id = await common.unit3d_region_ids(meta.get('region')) distributor_id = await common.unit3d_distributor_ids(meta.get('distributor')) - if meta['anon'] == 0 and bool(str2bool(str(self.config['TRACKERS'][self.tracker].get('anon', "False")))) == False: + if meta['anon'] == 0 and bool(str2bool(str(self.config['TRACKERS'][self.tracker].get('anon', "False")))) is False: anon = 0 else: anon = 1 - if meta['bdinfo'] != None: + if meta['bdinfo'] is not None: mi_dump = None bd_dump = open(f"{meta['base_dir']}/tmp/{meta['uuid']}/BD_SUMMARY_00.txt", 'r', encoding='utf-8').read() else: @@ -97,34 +96,34 @@ async def upload(self, meta): open_torrent = open(f"{meta['base_dir']}/tmp/{meta['uuid']}/[{self.tracker}]{meta['clean_name']}.torrent", 'rb') files = {'torrent': open_torrent} data = { - 'name' : meta['name'], - 'description' : desc, - 'mediainfo' : mi_dump, - 'bdinfo' : bd_dump, - 'category_id' : cat_id, - 'type_id' : type_id, - 'resolution_id' : resolution_id, - 'tmdb' : meta['tmdb'], - 'imdb' : meta['imdb_id'].replace('tt', ''), - 'tvdb' : meta['tvdb_id'], - 'mal' : meta['mal_id'], - 'igdb' : 0, - 'anonymous' : anon, - 'stream' : meta['stream'], - 'sd' : meta['sd'], - 'keywords' : meta['keywords'], - 'personal_release' : int(meta.get('personalrelease', False)), - 'internal' : 0, - 'featured' : 0, - 'free' : 0, - 'doubleup' : 0, - 'sticky' : 0, + 'name': meta['name'], + 'description': desc, + 'mediainfo': mi_dump, + 'bdinfo': bd_dump, + 'category_id': cat_id, + 'type_id': type_id, + 'resolution_id': resolution_id, + 'tmdb': meta['tmdb'], + 'imdb': meta['imdb_id'].replace('tt', ''), + 'tvdb': meta['tvdb_id'], + 'mal': meta['mal_id'], + 'igdb': 0, + 'anonymous': anon, + 'stream': meta['stream'], + 'sd': meta['sd'], + 'keywords': meta['keywords'], + 'personal_release': int(meta.get('personalrelease', False)), + 'internal': 0, + 'featured': 0, + 'free': 0, + 'doubleup': 0, + 'sticky': 0, } # Internal - if self.config['TRACKERS'][self.tracker].get('internal', False) == True: + if self.config['TRACKERS'][self.tracker].get('internal', False) is True: if meta['tag'] != "" and (meta['tag'][1:] in self.config['TRACKERS'][self.tracker].get('internal_groups', [])): data['internal'] = 1 - + if region_id != 0: data['region_id'] = region_id if distributor_id != 0: @@ -136,18 +135,18 @@ async def upload(self, meta): 'User-Agent': f'Upload Assistant/2.1 ({platform.system()} {platform.release()})' } params = { - 'api_token' : self.config['TRACKERS'][self.tracker]['api_key'].strip() + 'api_token': self.config['TRACKERS'][self.tracker]['api_key'].strip() } - - if meta['debug'] == False: + + if meta['debug'] is False: response = requests.post(url=self.upload_url, files=files, data=data, headers=headers, params=params) try: console.print(response.json()) - except: + except Exception: console.print("It may have uploaded, go check") - return + return else: - console.print(f"[cyan]Request Data:") + console.print("[cyan]Request Data:") console.print(data) open_torrent.close() @@ -155,12 +154,12 @@ async def search_existing(self, meta): dupes = [] console.print("[yellow]Searching for existing torrents on site...") params = { - 'api_token' : self.config['TRACKERS'][self.tracker]['api_key'].strip(), - 'tmdbId' : meta['tmdb'], - 'categories[]' : await self.get_cat_id(meta['category']), - 'types[]' : await self.get_type_id(meta['type']), - 'resolutions[]' : await self.get_res_id(meta['resolution']), - 'name' : "" + 'api_token': self.config['TRACKERS'][self.tracker]['api_key'].strip(), + 'tmdbId': meta['tmdb'], + 'categories[]': await self.get_cat_id(meta['category']), + 'types[]': await self.get_type_id(meta['type']), + 'resolutions[]': await self.get_res_id(meta['resolution']), + 'name': "" } if meta.get('edition', "") != "": params['name'] = params['name'] + f" {meta['edition']}" @@ -172,8 +171,8 @@ async def search_existing(self, meta): # difference = SequenceMatcher(None, meta['clean_name'], result).ratio() # if difference >= 0.05: dupes.append(result) - except: + except Exception: console.print('[bold red]Unable to search for existing torrents on site. Either the site is down or your API key is incorrect') await asyncio.sleep(5) - return dupes \ No newline at end of file + return dupes diff --git a/upload.py b/upload.py index 446e9b1c0..5f5fde7a4 100644 --- a/upload.py +++ b/upload.py @@ -242,17 +242,17 @@ async def do_the_thing(base_dir): trackers = [s.strip().upper() for s in trackers] if meta.get('manual', False): trackers.insert(0, "MANUAL") - + #################################### - ####### Upload to Trackers ####### + ####### Upload to Trackers ####### # noqa #F266 #################################### common = COMMON(config=config) - api_trackers = ['BLU', 'AITHER', 'STC', 'R4E', 'STT', 'RF', 'ACM','LCD','LST','HUNO', 'SN', 'LT', 'NBL', 'ANT', 'JPTV', 'TDC', 'OE', 'BHDTV', 'RTF', 'OTW', 'FNP', 'CBR', 'UTP','AL', 'HDB', 'SHRI'] + api_trackers = ['BLU', 'AITHER', 'STC', 'R4E', 'STT', 'RF', 'ACM', 'LCD', 'LST', 'HUNO', 'SN', 'LT', 'NBL', 'ANT', 'JPTV', 'TDC', 'OE', 'BHDTV', 'RTF', 'OTW', 'FNP', 'CBR', 'UTP', 'AL', 'HDB', 'SHRI'] http_trackers = ['HDB', 'TTG', 'FL', 'PTER', 'HDT', 'MTV'] tracker_class_map = { - 'BLU' : BLU, 'BHD': BHD, 'AITHER' : AITHER, 'STC' : STC, 'R4E' : R4E, 'THR' : THR, 'STT' : STT, 'HP' : HP, 'PTP' : PTP, 'RF' : RF, 'SN' : SN, - 'ACM' : ACM, 'HDB' : HDB, 'LCD': LCD, 'TTG' : TTG, 'LST' : LST, 'HUNO': HUNO, 'FL' : FL, 'LT' : LT, 'NBL' : NBL, 'ANT' : ANT, 'PTER': PTER, 'JPTV' : JPTV, - 'TL' : TL, 'TDC' : TDC, 'HDT' : HDT, 'MTV': MTV, 'OE': OE, 'BHDTV': BHDTV, 'RTF':RTF, 'OTW': OTW, 'FNP': FNP, 'CBR': CBR, 'UTP': UTP, 'AL': AL, 'SHRI': SHRI} + 'BLU': BLU, 'BHD': BHD, 'AITHER': AITHER, 'STC': STC, 'R4E': R4E, 'THR': THR, 'STT': STT, 'HP': HP, 'PTP': PTP, 'RF': RF, 'SN': SN, + 'ACM': ACM, 'HDB': HDB, 'LCD': LCD, 'TTG': TTG, 'LST': LST, 'HUNO': HUNO, 'FL': FL, 'LT': LT, 'NBL': NBL, 'ANT': ANT, 'PTER': PTER, 'JPTV': JPTV, + 'TL': TL, 'TDC': TDC, 'HDT': HDT, 'MTV': MTV, 'OE': OE, 'BHDTV': BHDTV, 'RTF': RTF, 'OTW': OTW, 'FNP': FNP, 'CBR': CBR, 'UTP': UTP, 'AL': AL, 'SHRI': SHRI} for tracker in trackers: if meta['name'].endswith('DUPE?'):