Skip to content

Commit

Permalink
Modify useAPI behavior with auto searching
Browse files Browse the repository at this point in the history
Now, if you want a site to be included in automatic ID/description parsing, useAPI = True in config.py.

using a site argument, `--ptp 12345` for instance, still works same, but regardless of useAPI status.

todo: add other UNIT3D sites that have good descriptions, or are otherwise useful for ID/screenshot matching.
  • Loading branch information
Audionut committed Oct 26, 2024
1 parent 0782dc8 commit 65f58f3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ 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/BLU (automatically on filename match or arg) / Aither/LST/OE (with arg)
- Can grab descriptions from PTP/BLU/Aither/LST/OE (with config option automatically on filename match, or using 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
Expand Down
44 changes: 36 additions & 8 deletions src/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,49 +510,49 @@ async def gather_prep(self, meta, mode):
if specific_tracker:
console.print(f"[blue]Processing only the {specific_tracker} tracker based on meta.[/blue]")

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

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

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

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

elif specific_tracker == 'OE' and str(self.config['TRACKERS'].get('OE', {}).get('useAPI')).lower() == "true":
elif specific_tracker == 'OE':
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 == 'TIK' and str(self.config['TRACKERS'].get('TIK', {}).get('useAPI')).lower() == "true":
elif specific_tracker == 'TIK':
tik = TIK(config=self.config)
meta, match = await self.update_metadata_from_tracker('TIK', tik, 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":
elif specific_tracker == 'HDB':
hdb = HDB(config=self.config)
meta, match = await self.update_metadata_from_tracker('HDB', hdb, meta, search_term, search_file_folder)
if match:
found_match = True
else:
# Process all trackers if no specific tracker is set in meta
# Process all trackers with API = true if no specific tracker is set in meta
default_trackers = self.config['TRACKERS'].get('default_trackers', "").split(", ")

if "PTP" in default_trackers and not found_match:
Expand All @@ -569,6 +569,34 @@ async def gather_prep(self, meta, mode):
if match:
found_match = True

if "AITHER" in default_trackers and not found_match:
if str(self.config['TRACKERS'].get('AITHER', {}).get('useAPI')).lower() == "true":
aither = AITHER(config=self.config)
meta, match = await self.update_metadata_from_tracker('AITHER', aither, meta, search_term, search_file_folder)
if match:
found_match = True

if "LST" in default_trackers and not found_match:
if str(self.config['TRACKERS'].get('LST', {}).get('useAPI')).lower() == "true":
lst = LST(config=self.config)
meta, match = await self.update_metadata_from_tracker('LST', lst, meta, search_term, search_file_folder)
if match:
found_match = True

if "OE" in default_trackers and not found_match:
if 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

if "TIK" in default_trackers and not found_match:
if str(self.config['TRACKERS'].get('TIK', {}).get('useAPI')).lower() == "true":
tik = TIK(config=self.config)
meta, match = await self.update_metadata_from_tracker('TIK', tik, meta, search_term, search_file_folder)
if match:
found_match = True

if "HDB" in default_trackers and not found_match:
if str(self.config['TRACKERS'].get('HDB', {}).get('useAPI')).lower() == "true":
hdb = HDB(config=self.config)
Expand Down

0 comments on commit 65f58f3

Please sign in to comment.