diff --git a/src/trackers/HDB.py b/src/trackers/HDB.py index cbe0b8975..7e205a29c 100644 --- a/src/trackers/HDB.py +++ b/src/trackers/HDB.py @@ -514,7 +514,7 @@ async def search_filename(self, search_term, search_file_folder, meta): url = "https://hdbits.org/api/torrents" # Handle disc case - if search_file_folder == 'folder' and meta.get('is_disc'): + if search_file_folder == 'folder' and meta.get('is_disc'): bd_summary_path = os.path.join(meta['base_dir'], 'tmp', meta['uuid'], 'BD_SUMMARY_00.txt') bd_summary = None diff --git a/src/trackers/PTP.py b/src/trackers/PTP.py index 253591966..79b479f90 100644 --- a/src/trackers/PTP.py +++ b/src/trackers/PTP.py @@ -96,12 +96,12 @@ async def get_ptp_id_imdb(self, search_term, search_file_folder, meta): response = requests.get(url, params=params, headers=headers) await asyncio.sleep(1) console.print(f"[green]Searching PTP for: [bold yellow]{filename}[/bold yellow]") - + try: if response.status_code == 200: response = response.json() # console.print(f"[blue]Raw API Response: {response}[/blue]") - + if int(response['TotalResults']) >= 1: for movie in response['Movies']: if len(movie['Torrents']) >= 1: @@ -113,43 +113,43 @@ async def get_ptp_id_imdb(self, search_term, search_file_folder, meta): ptp_torrent_id = torrent['Id'] dummy, ptp_torrent_hash, *_ = await self.get_imdb_from_torrent_id(ptp_torrent_id) console.print(f'[bold green]Matched release with PTP ID: [yellow]{ptp_torrent_id}[/yellow][/bold green]') - + # Call get_torrent_info and print the results tinfo = await self.get_torrent_info(imdb_id, meta) console.print(f"[cyan]Torrent Info: {tinfo}[/cyan]") - + return imdb_id, ptp_torrent_id, ptp_torrent_hash - + # If no match in filelist > path, check directly in filepath if torrent.get('FilePath') == filename: imdb_id = movie['ImdbId'] ptp_torrent_id = torrent['Id'] dummy, ptp_torrent_hash, *_ = await self.get_imdb_from_torrent_id(ptp_torrent_id) console.print(f'[bold green]Matched release with PTP ID: [yellow]{ptp_torrent_id}[/yellow][/bold green]') - + # Call get_torrent_info and print the results tinfo = await self.get_torrent_info(imdb_id, meta) console.print(f"[cyan]Torrent Info: {tinfo}[/cyan]") - + return imdb_id, ptp_torrent_id, ptp_torrent_hash console.print(f'[yellow]Could not find any release matching [bold yellow]{filename}[/bold yellow] on PTP') return None, None, None - + elif response.status_code in [400, 401, 403]: console.print(f"[bold red]PTP: {response.text}") return None, None, None - + elif response.status_code == 503: console.print("[bold yellow]PTP Unavailable (503)") return None, None, None else: return None, None, None - + except Exception as e: console.print(f'[red]An error occurred: {str(e)}[/red]') - + console.print(f'[yellow]Could not find any release matching [bold yellow]{filename}[/bold yellow] on PTP') return None, None, None