From ea1420998bcd8ba49c5f6a8575486fbfa25fb705 Mon Sep 17 00:00:00 2001 From: Audionut Date: Sun, 8 Sep 2024 10:59:56 +1000 Subject: [PATCH] Cleanup --- README.md | 8 +++++--- data/example-config.py | 8 ++++---- upload.py | 39 ++++++++++----------------------------- 3 files changed, 19 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 86f2a571f..1a1b9b00f 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,15 @@ A simple tool to take the work out of uploading. - Generates and Parses MediaInfo/BDInfo. - Generates and Uploads screenshots. - Uses srrdb to fix scene filenames - - Can grab descriptions from PTP (automatically on filename match or arg) / BLU (arg) + - Can grab descriptions from PTP/BLU (automatically on filename match or arg) / Aither/LST/OE (with arg) + - Can strip existing screenshots from descriptions to skip screenshot generation and uploading - Obtains TMDb/IMDb/MAL identifiers. - Converts absolute to season episode numbering for Anime - Generates custom .torrents without useless top level folders/nfos. - 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/HDB/AL/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/OE/TL/BHDTV/HDT/JPTV/LT/MTV/PTER/TDC/TTG/UTP - 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 @@ -33,7 +34,7 @@ Built with updated BDInfoCLI from https://github.com/rokibhasansagar/BDInfoCLI-n - Also needs MediaInfo and ffmpeg installed on your system - On Windows systems, ffmpeg must be added to PATH (https://windowsloop.com/install-ffmpeg-windows-10/) - On linux systems, get it from your favorite package manager - - Clone the repo to your system `git clone https://github.com/Audionut/Upload-Assistant.git` + - Clone the repo to your system `git clone https://github.com/Audionut/Upload-Assistant.git` - or download a zip of the source - Copy and Rename `data/example-config.py` to `data/config.py` - Edit `config.py` to use your information (more detailed information in the [wiki](https://github.com/Audionut/Upload-Assistant/wiki)) - tmdb_api (v3) key can be obtained from https://developers.themoviedb.org/3/getting-started/introduction @@ -50,6 +51,7 @@ Built with updated BDInfoCLI from https://github.com/rokibhasansagar/BDInfoCLI-n - To update first navigate into the Upload-Assistant directory: `cd Upload-Assistant` - Run a `git pull` to grab latest updates - Run `python3 -m pip install --user -U -r requirements.txt` to ensure dependencies are up to date + - Or download a fresh zip and overwrite existing files ## **CLI Usage:** `python3 upload.py /downloads/path/to/content --args` diff --git a/data/example-config.py b/data/example-config.py index e0d222cba..ce739e71c 100644 --- a/data/example-config.py +++ b/data/example-config.py @@ -37,7 +37,7 @@ "TRACKERS": { # Which trackers do you want to upload to? # Available tracker: BLU, BHD, AITHER, STC, STT, SN, THR, R4E, HP, ACM, PTP, LCD, LST, PTER, NBL, ANT, MTV, CBR, RTF, HUNO, BHDTV, LT, PTER, TL, TDC, HDT, OE, RF, OTW, FNP, UTP, AL, HDB - # Remove the ones not used to save being asked everytime + # Remove the trackers from the default_trackers list that are not used, to save being asked everytime "default_trackers": "BLU, BHD, AITHER, STC, STT, SN, THR, R4E, HP, ACM, PTP, LCD, LST, PTER, NBL, ANT, MTV, CBR, RTF, HUNO, BHDTV, LT, PTER, TL, TDC, HDT, OE, RF, OTW, FNP, UTP, AL, HDB", "BLU": { @@ -241,9 +241,9 @@ }, }, - # enable_search to true will automatically try and find a suitable hash to save having to rehash when creating torrents + # enable_search to True will automatically try and find a suitable hash to save having to rehash when creating torrents # Should use the qbit API, but will also use the torrent_storage_dir to find suitable hashes - # If you find issue, use the "--debug" command option to print out some related details + # If you find issue, use the "--debug" argument to print out some related details "TORRENT_CLIENTS": { # Name your torrent clients here, for example, this example is named "Client1" and is set as default_torrent_client above # All options relate to the webui, make sure you have the webui secured if it has WAN access @@ -255,7 +255,7 @@ "qbit_port": "8080", "qbit_user": "username", "qbit_pass": "password", - # "torrent_storage_dir": "path/to/BT_backup folder" + # "torrent_storage_dir": "path/to/BT_backup folder" ## use double-backslash on windows eg: "C:\\client\\backup" # Remote path mapping (docker/etc.) CASE SENSITIVE # "local_path": "/LocalPath", diff --git a/upload.py b/upload.py index 9a3339e08..249e257b7 100644 --- a/upload.py +++ b/upload.py @@ -247,8 +247,8 @@ async def do_the_thing(base_dir): ####### Upload to Trackers ####### # noqa #F266 #################################### common = COMMON(config=config) - api_trackers = ['BLU', 'AITHER', 'STC', 'R4E', 'STT', 'RF', 'ACM', 'LCD', 'HUNO', 'SN', 'LT', 'NBL', 'ANT', 'JPTV', 'TDC', 'OE', 'BHDTV', 'RTF', 'OTW', 'FNP', 'CBR', 'UTP', 'AL', 'HDB', 'SHRI', 'LST', 'BHD'] - http_trackers = ['TTG', 'FL', 'PTER', 'HDT', 'MTV'] + api_trackers = ['BLU', 'AITHER', 'STC', 'R4E', 'STT', 'RF', 'ACM', 'LCD', 'HUNO', 'SN', 'LT', 'NBL', 'ANT', 'JPTV', 'TDC', 'OE', 'BHDTV', 'RTF', 'OTW', 'FNP', 'CBR', 'UTP', 'AL', 'SHRI', 'LST', 'BHD', 'TL'] + 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, @@ -322,16 +322,17 @@ async def check_mod_q_and_draft(tracker_class, meta, debug): if check_banned_group(tracker_class.tracker, tracker_class.banned_groups, meta): continue - # Perform the existing checks for dupes - if tracker == "RTF": - await tracker_class.api_test(meta) + # Perform the existing checks for dupes except TL + if tracker != "TL": + if tracker == "RTF": + await tracker_class.api_test(meta) - dupes = await tracker_class.search_existing(meta) - dupes = await common.filter_dupes(dupes, meta) - meta = dupe_check(dupes, meta) + dupes = await tracker_class.search_existing(meta) + dupes = await common.filter_dupes(dupes, meta) + meta = dupe_check(dupes, meta) # Proceed with upload if the meta is set to upload - if meta['upload']: + if tracker == "TL" or meta.get('upload', False): await tracker_class.upload(meta) if tracker == 'SN': await asyncio.sleep(16) @@ -463,26 +464,6 @@ async def check_mod_q_and_draft(tracker_class, meta, debug): except Exception: console.print(traceback.print_exc()) - if tracker == "TL": - tracker_class = tracker_class_map[tracker](config=config) - if meta['unattended']: - upload_to_tracker = True - else: - try: - upload_to_ptp = cli_ui.ask_yes_no( - f"Upload to {tracker}? {debug}", - default=meta['unattended'] - ) - except (KeyboardInterrupt, EOFError): - sys.exit(1) # Exit immediately - - if upload_to_tracker: - console.print(f"Uploading to {tracker_class.tracker}") - if check_banned_group(tracker_class.tracker, tracker_class.banned_groups, meta): - continue - await tracker_class.upload(meta) - await client.add_to_client(meta, tracker_class.tracker) - def get_confirmation(meta): if meta['debug'] is True: