Skip to content

Commit

Permalink
Skipping any part of auto ptp skips the original PTP description hand…
Browse files Browse the repository at this point in the history
…ling
  • Loading branch information
Audionut committed Aug 31, 2024
1 parent 68c20f6 commit a731113
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ async def prompt_user_for_id_selection(self, blu_tmdb=None, blu_imdb=None, blu_t
console.print(f"IMDb ID: https://www.imdb.com/title/tt{blu_imdb}")
console.print(f"TVDb ID: {blu_tvdb}")
console.print(f"Filename: {blu_filename}")

if blu_imdb: # Assuming blu_imagelist would be linked with this function
if meta.get('image_list'):
console.print("[cyan]Found the following images:")
for img in meta['image_list']:
console.print(f"[blue]{img}")

selection = input("Do you want to use this ID? (y/n): ").strip().lower()
return selection == 'y'
Expand Down Expand Up @@ -185,17 +179,20 @@ async def update_metadata_from_tracker(self, tracker_name, tracker_instance, met
if ptp_desc.strip():
meta['description'] = ptp_desc
meta['image_list'] = ptp_imagelist
meta['skip_gen_desc'] = True
console.print(f"[green]PTP description and images added to metadata.")

if await self.prompt_user_for_confirmation("Do you want to keep the description from PTP?"):
meta['skip_gen_desc'] = True
found_match = True
else:
console.print(f"[yellow]Description discarded from PTP")
meta['skip_gen_desc'] = True
meta['description'] = None
return meta, found_match
else:
console.print(f"[yellow]User skipped the found IMDb ID on {tracker_name}, moving to the next site.")
meta['skip_gen_desc'] = True
return meta, found_match

elif tracker_name == "HDB":
Expand Down Expand Up @@ -251,10 +248,12 @@ async def update_metadata_from_tracker(self, tracker_name, tracker_instance, met
found_match = True
else:
console.print(f"[yellow]Description discarded from PTP")
meta['skip_gen_desc'] = True
meta['description'] = None
return meta, found_match
else:
console.print(f"[yellow]User skipped the found IMDb ID on {tracker_name}, moving to the next site.")
meta['skip_gen_desc'] = True
return meta, found_match
else:
console.print(f"[yellow]No IMDb ID found on {tracker_name}")
Expand Down Expand Up @@ -2931,9 +2930,6 @@ def clean_filename(self, name):
return name

async def gen_desc(self, meta):
if meta.get('skip_gen_desc', False):
console.print("[cyan]Skipping description generation as PTP description was retained.")
return meta

desclink = meta.get('desclink', None)
descfile = meta.get('descfile', None)
Expand All @@ -2953,6 +2949,9 @@ async def gen_desc(self, meta):
desc_source = desc_source[0]

if meta.get('ptp', None) is not None and str(self.config['TRACKERS'].get('PTP', {}).get('useAPI')).lower() == "true" and desc_source in ['PTP', None]:
if meta.get('skip_gen_desc', False):
console.print("[cyan]Skipping description generation as PTP description was retained.")
return meta
ptp = PTP(config=self.config)
ptp_desc, imagelist = await ptp.get_ptp_description(meta['ptp'], meta['is_disc'])
if ptp_desc.replace('\r\n', '').replace('\n', '').strip() != "":
Expand Down

0 comments on commit a731113

Please sign in to comment.