diff --git a/qbit-maid.py b/qbit-maid.py index 293054c..35a8906 100644 --- a/qbit-maid.py +++ b/qbit-maid.py @@ -14,7 +14,7 @@ class Qbt: # Open the config. Needs a json file with the data in config.json.example c = open('./config.json') self.config = load(c) - w = open('./config.json') + w = open('./category-whitelist.json') self.cat_whitelist = load(w) # Create the api object self.qbt_client = qbittorrentapi.Client( diff --git a/qlist.py b/qlist.py index 6cb9cf8..f4d3fb1 100644 --- a/qlist.py +++ b/qlist.py @@ -4,13 +4,11 @@ def buildtorlist(self): V2 will certainly be more performant. The reason two lists were used was so that torrents that are in public trackers woudln't be around as long as torrents from a private tracker. """ - self.protected_count = 0 - self.nonprotected_count = 0 while self.torrentlist: torrent = self.torrentlist.pop() if self.use_log: self.tl.debug(f'["{torrent["name"][0:20]}..."] {torrent["infohash_v1"]}') - if torrent['tags'] in self.cat_whitelist.values(): + if torrent['category'] in self.cat_whitelist.values(): self.tl.info(f'Ignored torrent:["{torrent["name"][0:20]}..."]') continue if torrent['tracker'] == '': @@ -20,13 +18,11 @@ def buildtorlist(self): if torrent['tracker'].split('/')[2] in self.tracker_whitelist.values(): if self.use_log: self.tl.debug(f'Protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}') - self.protected_count += 1 self.qbt_client.torrents_add_tags(self.tracker_protected_tag,torrent['hash']) self.tracker_protected_list.append(torrent) - elif torrent['tracker'].split('/')[2] not in self.tracker_whitelist.values(): + if torrent['tracker'].split('/')[2] not in self.tracker_whitelist.values(): if self.use_log: self.tl.debug(f'Non-protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}') - self.nonprotected_count += 1 self.qbt_client.torrents_add_tags(self.tracker_non_protected_tag,torrent['hash']) self.tracker_nonprotected_list.append(torrent) diff --git a/qprocess.py b/qprocess.py index 4cbc570..0147b17 100644 --- a/qprocess.py +++ b/qprocess.py @@ -3,7 +3,7 @@ def torprocessor(self): If torrent meets criteria for deletion, its infohash_v1 will be appended to self.torrent_hash_delete_list """ for canidate in self.tracker_nonprotected_list: - if canidate['tags'] in self.cat_whitelist.values(): + if self.config["protected_tag"] in canidate['tags']: if self.use_log: self.tl.warning(f'["{canidate["name"][0:20]}..."] was in non-protected list.') continue