Skip to content

Commit

Permalink
Revert some client.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Audionut committed Nov 25, 2024
1 parent dc4c742 commit ea336a7
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ async def qbittorrent(self, path, torrent, local_path, remote_path, client, is_d
path = os.path.dirname(path)

# Ensure remote path replacement and normalization
if path.startswith(local_path) and local_path.lower() != remote_path.lower():
path = path.replace(local_path, remote_path, 1)
if local_path.lower() in path.lower() and local_path.lower() != remote_path.lower():
path = path.replace(local_path, remote_path)
path = path.replace(os.sep, '/')

# Ensure trailing slash for qBittorrent
Expand All @@ -362,15 +362,13 @@ async def qbittorrent(self, path, torrent, local_path, remote_path, client, is_d
auto_management = False
am_config = client.get('automatic_management_paths', '')
if isinstance(am_config, list):
auto_management = any(
os.path.normpath(each).lower() in os.path.normpath(path).lower()
for each in am_config
)
elif am_config.strip():
auto_management = os.path.normpath(am_config).lower() in os.path.normpath(path).lower()

# Set qBittorrent category and content layout
qbt_category = meta.get("qbit_cat", client.get("qbit_cat"))
for each in am_config:
if os.path.normpath(each).lower() in os.path.normpath(path).lower():
auto_management = True
else:
if os.path.normpath(am_config).lower() in os.path.normpath(path).lower() and am_config.strip() != "":
auto_management = True
qbt_category = client.get("qbit_cat") if not meta.get("qbit_cat") else meta.get('qbit_cat')
content_layout = client.get('content_layout', 'Original')

# Add the torrent
Expand Down

0 comments on commit ea336a7

Please sign in to comment.