Skip to content

Commit

Permalink
FIX - MTV only reupload if original host not allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
Audionut committed Aug 20, 2024
1 parent 600ad42 commit b3de856
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/trackers/MTV.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ async def upload_with_retry(self, meta, cookiefile, common, img_host_index=1):
if not current_img_host or current_img_host not in approved_image_hosts:
console.print("[red]Your preferred image host is not supported at MTV, re-uploading to an allowed image host.")
img_host_index += 1
retry_mode = True # Set retry_mode to True if switching to an approved host
continue

meta['imghost'] = current_img_host
retry_mode = False # No retry unless switching to another host

torrent_filename = "BASE"
torrent_path = f"{meta['base_dir']}/tmp/{meta['uuid']}/BASE.torrent"
Expand All @@ -80,14 +82,25 @@ async def upload_with_retry(self, meta, cookiefile, common, img_host_index=1):
# Screenshot and upload process
prep.screenshots(Path(meta['path']), meta['name'], meta['uuid'], meta['base_dir'], meta)
return_dict = {}
prep.upload_screens(meta, screens=meta['screens'], img_host_num=img_host_index, i=0, total_screens=meta['screens'], custom_img_list=[], return_dict=return_dict, retry_mode=True)


# Only enable retry_mode if switching to an approved image host
prep.upload_screens(
meta,
screens=meta['screens'],
img_host_num=img_host_index,
i=0,
total_screens=meta['screens'],
custom_img_list=[],
return_dict=return_dict,
retry_mode=retry_mode
)

# Update meta['image_list'] with uploaded images
meta['image_list'] = return_dict.get('image_list', [])

# Ensure images are from approved hosts
if not all(any(x in image['raw_url'] for x in approved_image_hosts) for image in meta['image_list']):
console.print("[red]Unsupported image host detected, please use one of the approved imagehosts")
console.print("[red]Unsupported image host detected, please use one of the approved image hosts")
img_host_index += 1
continue

Expand Down

0 comments on commit b3de856

Please sign in to comment.