Skip to content

Commit

Permalink
Add OE filename/description parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Audionut committed Sep 7, 2024
1 parent b9302bb commit 53727f3
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
14 changes: 14 additions & 0 deletions src/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def parse(self, args, meta):
parser.add_argument('-blu', '--blu', nargs='*', required=False, help="BLU torrent id/link", type=str)
parser.add_argument('-aither', '--aither', nargs='*', required=False, help="Aither torrent id/link", type=str)
parser.add_argument('-lst', '--lst', nargs='*', required=False, help="LST torrent id/link", type=str)
parser.add_argument('-oe', '--oe', nargs='*', required=False, help="OE torrent id/link", type=str)
parser.add_argument('-hdb', '--hdb', nargs='*', required=False, help="HDB torrent id/link", type=str)
parser.add_argument('-d', '--desc', nargs='*', required=False, help="Custom Description (string)")
parser.add_argument('-pb', '--desclink', nargs='*', required=False, help="Custom Description (link to hastebin/pastebin)")
Expand Down Expand Up @@ -165,6 +166,19 @@ def parse(self, args, meta):
console.print('[red]Continuing without --lst')
else:
meta['lst'] = value2
elif key == 'oe':
if value2.startswith('http'):
parsed = urllib.parse.urlparse(value2)
try:
oepath = parsed.path
if oepath.endswith('/'):
oepath = oepath[:-1]
meta['oe'] = oepath.split('/')[-1]
except Exception:
console.print('[red]Unable to parse id from url')
console.print('[red]Continuing without --oe')
else:
meta['oe'] = value2
elif key == 'hdb':
if value2.startswith('http'):
parsed = urllib.parse.urlparse(value2)
Expand Down
19 changes: 14 additions & 5 deletions src/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from src.trackers.BLU import BLU
from src.trackers.AITHER import AITHER
from src.trackers.LST import LST
from src.trackers.OE import OE
from src.trackers.HDB import HDB
from src.trackers.COMMON import COMMON

Expand Down Expand Up @@ -155,7 +156,7 @@ async def update_metadata_from_tracker(self, tracker_name, tracker_instance, met
manual_key = f"{tracker_key}_manual"
found_match = False

if tracker_name in ["BLU", "AITHER", "LST"]: # Example for UNIT3D trackers
if tracker_name in ["BLU", "AITHER", "LST", "OE"]:
if meta.get(tracker_key) is not None:
console.print(f"[cyan]{tracker_name} ID found in meta, reusing existing ID: {meta[tracker_key]}[/cyan]")
tracker_data = await COMMON(self.config).unit3d_torrent_info(
Expand Down Expand Up @@ -446,6 +447,8 @@ async def gather_prep(self, meta, mode):
specific_tracker = 'AITHER'
elif meta.get('lst'):
specific_tracker = 'LST'
elif meta.get('oe'):
specific_tracker = 'OE'

# If a specific tracker is found, only process that one
if specific_tracker:
Expand Down Expand Up @@ -475,6 +478,12 @@ async def gather_prep(self, meta, mode):
if match:
found_match = True

elif specific_tracker == 'OE' and str(self.config['TRACKERS'].get('OE', {}).get('useAPI')).lower() == "true":
oe = OE(config=self.config)
meta, match = await self.update_metadata_from_tracker('OE', oe, meta, search_term, search_file_folder)
if match:
found_match = True

elif specific_tracker == 'HDB' and str(self.config['TRACKERS'].get('HDB', {}).get('useAPI')).lower() == "true":
hdb = HDB(config=self.config)
meta, match = await self.update_metadata_from_tracker('HDB', hdb, meta, search_term, search_file_folder)
Expand Down Expand Up @@ -1324,8 +1333,8 @@ def screenshots(self, path, filename, folder_id, base_dir, meta, num_screens=Non
.global_args('-loglevel', loglevel)
.run(quiet=debug)
)
except Exception:
console.print(traceback.format_exc())
except (KeyboardInterrupt, Exception):
sys.exit(1)

self.optimize_images(image_path)
if os.path.getsize(Path(image_path)) <= 75000:
Expand Down Expand Up @@ -1394,8 +1403,8 @@ def optimize_images(self, image):
oxipng.optimize(image, level=6)
else:
oxipng.optimize(image, level=3)
except Exception:
pass
except (KeyboardInterrupt, Exception):
sys.exit(1)
return

"""
Expand Down
1 change: 1 addition & 0 deletions src/trackers/AITHER.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, config):
self.source_flag = 'Aither'
self.search_url = 'https://aither.cc/api/torrents/filter'
self.upload_url = 'https://aither.cc/api/torrents/upload'
self.torrent_url = 'https://aither.cc/api/torrents/'
self.signature = "\n[center][url=https://aither.cc/forums/topics/1349/posts/24958]Created by L4G's Upload Assistant[/url][/center]"
self.banned_groups = ['4K4U', 'AROMA', 'd3g', 'edge2020', 'EMBER', 'EVO', 'FGT', 'FreetheFish', 'Hi10', 'HiQVE', 'ION10', 'iVy', 'Judas', 'LAMA', 'MeGusta', 'nikt0', 'OEPlus', 'OFT', 'OsC', 'PYC',
'QxR', 'Ralphy', 'RARBG', 'RetroPeeps', 'SAMPA', 'Sicario', 'Silence', 'SkipTT', 'SPDVD', 'STUTTERSHIT', 'SWTYBLZ', 'TAoE', 'TGx', 'Tigole', 'TSP', 'TSPxL', 'VXT', 'Weasley[HONE]',
Expand Down
3 changes: 2 additions & 1 deletion src/trackers/COMMON.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,12 @@ async def unit3d_torrent_info(self, tracker, torrent_url, search_url, id=None, f
return None, None, None, None, None, None, None, None, None

response = requests.get(url=url, params=params)
# console.print(f"[blue]Raw API Response: {response}[/blue]")

try:
json_response = response.json()

# console.print(f"[blue]Raw API Response: {json_response}[/blue]")
# console.print(f"[blue]Raw API Response: {json_response}[/blue]", markup=False)

except ValueError:
return None, None, None, None, None, None, None, None, None
Expand Down
1 change: 1 addition & 0 deletions src/trackers/LST.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, config):
self.source_flag = 'LST.GG'
self.upload_url = 'https://lst.gg/api/torrents/upload'
self.search_url = 'https://lst.gg/api/torrents/filter'
self.torrent_url = 'https://lst.gg/api/torrents/'
self.signature = "\n[center][url=https://github.com/Audionut/Upload-Assistant]Created by L4G's Upload Assistant[/url][/center]"
self.banned_groups = ['aXXo', 'BRrip', 'CM8', 'CrEwSaDe', 'CTFOH', 'DNL', 'FaNGDiNG0', 'HD2DVD', 'HDTime', 'ION10', 'iPlanet', 'KiNGDOM',
'mHD', 'mSD', 'nHD', 'nikt0', 'nSD', 'NhaNc3', 'OFT', 'PRODJi', 'SANTi', 'STUTTERSHIT', 'ViSION', 'VXT', 'WAF',
Expand Down
1 change: 1 addition & 0 deletions src/trackers/OE.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(self, config):
self.source_flag = 'OE'
self.search_url = 'https://onlyencodes.cc/api/torrents/filter'
self.upload_url = 'https://onlyencodes.cc/api/torrents/upload'
self.torrent_url = 'https://onlyencodes.cc/api/torrents/'
self.signature = "\n[center][url=https://github.com/Audionut/Upload-Assistant]Created by L4G's Upload Assistant[/url][/center]"
self.banned_groups = ['0neshot', '3LT0N', '4K4U', '4yEo', '$andra', '[Oj]', 'AFG', 'AkihitoSubs', 'AniHLS', 'Anime Time', 'AnimeRG', 'AniURL', 'AR', 'AROMA', 'ASW', 'aXXo', 'BakedFish', 'BiTOR', 'BHDStudio', 'BRrip', 'bonkai', 'Cleo', 'CM8', 'C4K', 'CrEwSaDe', 'core', 'd3g', 'DDR', 'DeadFish', 'DeeJayAhmed', 'DNL', 'ELiTE', 'EMBER', 'eSc', 'EVO', 'EZTV', 'FaNGDiNG0', 'FGT', 'fenix', 'FUM', 'FRDS', 'FROZEN', 'GalaxyTV', 'GalaxyRG', 'GERMini', 'Grym', 'GrymLegacy', 'HAiKU', 'HD2DVD', 'HDTime', 'Hi10', 'ION10', 'iPlanet', 'JacobSwaggedUp', 'JIVE', 'Judas', 'KiNGDOM', 'LAMA', 'Leffe', 'LiGaS', 'LOAD', 'LycanHD', 'MeGusta,' 'MezRips,' 'mHD,' 'Mr.Deadpool', 'mSD', 'NemDiggers', 'neoHEVC', 'NeXus', 'NhaNc3', 'nHD', 'nikt0', 'nSD', 'NhaNc3', 'NOIVTC', 'pahe.in', 'PlaySD', 'playXD', 'PRODJi', 'ProRes', 'project-gxs', 'PSA', 'QaS', 'Ranger', 'RAPiDCOWS', 'RARBG', 'Raze', 'RCDiVX', 'RDN', 'Reaktor', 'REsuRRecTioN', 'RMTeam', 'ROBOTS', 'rubix', 'SANTi', 'SHUTTERSHIT', 'SpaceFish', 'SPASM', 'SSA', 'TBS', 'Telly,' 'Tenrai-Sensei,' 'TERMiNAL,' 'TM', 'topaz', 'TSP', 'TSPxL', 'Trix', 'URANiME', 'UTR', 'VipapkSudios', 'ViSION', 'WAF', 'Wardevil', 'x0r', 'xRed', 'XS', 'YakuboEncodes', 'YIFY', 'YTS', 'YuiSubs', 'ZKBL', 'ZmN', 'ZMNT']
pass
Expand Down

0 comments on commit 53727f3

Please sign in to comment.