Skip to content

Commit

Permalink
Make sure to pass meta
Browse files Browse the repository at this point in the history
  • Loading branch information
Audionut committed Aug 17, 2024
1 parent e637077 commit 414528a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ async def search_qbit_for_torrent(self, meta, client):

try:
torrents = qbt_client.torrents.info()
if meta.get('debug'):
console.log(f"[debug] Retrieved torrents from qBittorrent API: {torrents}")
for torrent in torrents:
torrent_path = self.get_torrent_path(torrent, meta, remote_path_map, local_path, remote_path)
if torrent_path and await self.is_matching_torrent(meta, torrent, torrent_path, torrent_storage_dir):
Expand Down Expand Up @@ -249,12 +247,12 @@ def get_torrent_path(self, torrent, meta, remote_path_map, local_path, remote_pa
async def is_matching_torrent(self, meta, torrent, torrent_path, torrent_storage_dir):
if meta['is_disc'] in ("", None) and len(meta['filelist']) == 1:
if torrent_path == meta['filelist'][0] and len(torrent.files) == len(meta['filelist']):
return await self.verify_torrent(torrent, torrent_storage_dir)
return await self.verify_torrent(meta, torrent, torrent_storage_dir)
elif meta['path'] == torrent_path:
return await self.verify_torrent(torrent, torrent_storage_dir)
return await self.verify_torrent(meta, torrent, torrent_storage_dir)
return False

async def verify_torrent(self, torrent, torrent_storage_dir):
async def verify_torrent(self, meta, torrent, torrent_storage_dir):
valid, torrent_path = await self.is_valid_torrent(meta, f"{torrent_storage_dir}/{torrent.hash}.torrent", torrent.hash, 'qbit', print_err=False)
if valid:
console.print(f"[green]Found a matching .torrent with hash: [bold yellow]{torrent.hash}")
Expand Down

0 comments on commit 414528a

Please sign in to comment.