Skip to content

Commit

Permalink
fix: ignore patterns needs to be convert to a string
Browse files Browse the repository at this point in the history
Signed-off-by: Devin Buhl <devin@buhl.casa>
  • Loading branch information
onedr0p committed Aug 23, 2023
1 parent 5117de7 commit 7d0c615
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions qbittools/commands/orphaned.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
def __init__(args, logger):
client = qbittools.qbit_client(args)
completed_dir = str(qbittools.config.save_path)
ignore_patterns = ' '.join(args.ignore_patterns)

torrent_list = client.torrents.info()
completed_dir_list = completed_dir.split(os.sep)

logger.info(f"Checking for orphaned files in qBittorrent")
logger.info(f"Not deleting files in {completed_dir} that are in qBittorrent")
logger.info(f"Use --confirm to delete files in {completed_dir} that are not in qBittorrent")
logger.info(f"Ignoring file/folder patterns '{' '.join(args.ignore_patterns)}'")
logger.info(f"Ignoring file/folder patterns '{ignore_patterns}'")

logger.info(f"Getting a list of all torrents 'content_path' in qBittorrent")
qbittorrent_items = set()
Expand All @@ -41,7 +42,7 @@ def __init__(args, logger):
contents = os.listdir(folder_path)
for item in contents:
item_path = os.path.join(folder_path, item)
if not any(fnmatch(item, pattern) or fnmatch(item_path, pattern) for pattern in args.ignore_patterns.split()):
if not any(fnmatch(item, pattern) or fnmatch(item_path, pattern) for pattern in ignore_patterns.split()):
if item_path not in qbittorrent_items:
if not args.confirm:
logger.info(f"Skipping deletion of {item_path}")
Expand Down

0 comments on commit 7d0c615

Please sign in to comment.