mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-11-10 00:10:46 +08:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
a113179e48
commit
8d8e171b81
1 changed files with 9 additions and 10 deletions
|
|
@ -1,13 +1,15 @@
|
|||
import os
|
||||
from multiprocessing import Pool, cpu_count
|
||||
from itertools import repeat
|
||||
from fnmatch import fnmatch
|
||||
from itertools import repeat
|
||||
from multiprocessing import cpu_count
|
||||
from multiprocessing import Pool
|
||||
|
||||
from modules import util
|
||||
|
||||
logger = util.logger
|
||||
_config = None
|
||||
|
||||
|
||||
class RemoveOrphaned:
|
||||
def __init__(self, qbit_manager):
|
||||
self.qbt = qbit_manager
|
||||
|
|
@ -49,7 +51,6 @@ class RemoveOrphaned:
|
|||
if self.orphaned_dir not in path
|
||||
]
|
||||
|
||||
|
||||
# Get an updated list of torrents
|
||||
logger.print_line("Removing torrent files from orphans", self.config.loglevel)
|
||||
torrent_list = self.qbt.get_torrents({"sort": "added_on"})
|
||||
|
|
@ -70,10 +71,7 @@ class RemoveOrphaned:
|
|||
for exclude_pattern in self.config.orphaned["exclude_patterns"]
|
||||
]
|
||||
excluded_orphan_files = [
|
||||
file
|
||||
for file in orphaned_files
|
||||
for exclude_pattern in exclude_patterns
|
||||
if fnmatch(file, exclude_pattern)
|
||||
file for file in orphaned_files for exclude_pattern in exclude_patterns if fnmatch(file, exclude_pattern)
|
||||
]
|
||||
|
||||
orphaned_files = set(orphaned_files) - set(excluded_orphan_files)
|
||||
|
|
@ -111,6 +109,7 @@ class RemoveOrphaned:
|
|||
else:
|
||||
logger.print_line("No Orphaned Files found.", self.config.loglevel)
|
||||
|
||||
|
||||
def move_orphan(file):
|
||||
src = file.replace(_config.root_dir, _config.remote_dir) # Could be optimized to only run when root != remote
|
||||
dest = os.path.join(_config.orphaned_dir, file.replace(_config.root_dir, ""))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue