Skip to content

Commit

Permalink
Merge branch 'master' into queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Audionut committed Nov 26, 2024
2 parents 0956eaf + ac29c15 commit 43c9ae1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def parse(self, args, meta):
parser.add_argument('--no-edition', dest='no_edition', action='store_true', required=False, help="Remove Edition from title")
parser.add_argument('--dual-audio', dest='dual_audio', action='store_true', required=False, help="Add Dual-Audio to the title")
parser.add_argument('-ns', '--no-seed', action='store_true', required=False, help="Do not add torrent to the client")
parser.add_argument('-year', '--year', dest='manual_year', nargs='?', required=False, help="Year", type=int, default=0)
parser.add_argument('-ptp', '--ptp', nargs='*', required=False, help="PTP torrent id/permalink", type=str)
parser.add_argument('-blu', '--blu', nargs='*', required=False, help="BLU torrent id/link", type=str)
parser.add_argument('-aither', '--aither', nargs='*', required=False, help="Aither torrent id/link", type=str)
Expand Down
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 43c9ae1

Please sign in to comment.