From 8c32f32c854fea733501a8b6851d26d76ce0f00e Mon Sep 17 00:00:00 2001 From: jblu Date: Sat, 1 Oct 2022 13:10:42 -0500 Subject: [PATCH] #31 and lots of other changes --- qbit-maid.py | 4 ++-- qlogging.py | 30 +++--------------------------- qprocess.py | 3 ++- 3 files changed, 7 insertions(+), 30 deletions(-) diff --git a/qbit-maid.py b/qbit-maid.py index a46a3bf..c9c50e7 100644 --- a/qbit-maid.py +++ b/qbit-maid.py @@ -76,8 +76,8 @@ class Qbt: list_first_tor(self) build_tor_list(self) process_counts(self) - # if self.use_log: - # torrent_count(self) + if self.use_log: + torrent_count(self) tor_processor(self) if self.use_log: print_processor(self) diff --git a/qlogging.py b/qlogging.py index 65c8e91..75a675b 100644 --- a/qlogging.py +++ b/qlogging.py @@ -42,17 +42,6 @@ def tor_notify_summary(self): Marked for deletion: {len(self.torrent_hash_delete_list)}\n\ {self.extm}", title="--- qbit-maid summary ---") -def getunixtimestamp(self): - """Used for debuging and development related to unixtimestamps, not used in main script but useful""" - self.uts = self.t.time() - self.tl.info(self.uts) - -def writetor(self, filepath='./torrentinfo.json'): - """Write all torrent data to a file. - Useful for development of new features. - """ - pass - def list_first_tor(self, index=0): """Only lists the first torrent""" self.tl.debug('First torrent in the list:') @@ -68,25 +57,12 @@ def list_qbit_api_info(self): def torrent_count(self): """write torrent counts to log file""" - #Doesn't work because tracker_list doesn't have a count property. Each object does. List comprehension? - self.tl.debug(f'torrents that are protected {self.tracker_list.count("ipt")}') - self.tl.debug(f'torrents that aren\'t protected {self.tracker_list.count("public")}') - -def torlisttags(self): - pass - -def debugpremecal(self): - for torrent in self.torrent_list: - if torrent['infohash_v1'] == 'a89b484ea375094af53ce89ecbea14bf086d6284': - print(torrent["name"][0:20]) - print(torrent['added_on'] + self.minimum_age >= self.t.time()) + self.tl.debug(f'*** Torrents with tag["{self.tracker_protected_tag}"] {self.c[self.tracker_protected_tag]} ***') + self.tl.debug(f'*** Torrents with tag["{self.tracker_non_protected_tag}"] {self.c[self.tracker_non_protected_tag]} ***') def get_script_runtime(self): elapsed_time = self.et - self.st if self.use_log: self.tl.info(f'Execution time: [{elapsed_time}]') if self.use_pushover: - self.extm = f"Execution time: [{elapsed_time}]" - -def getobjecttype(object): - print(type(object)) \ No newline at end of file + self.extm = f"Execution time: [{elapsed_time}]" \ No newline at end of file diff --git a/qprocess.py b/qprocess.py index cde69c6..78a5697 100644 --- a/qprocess.py +++ b/qprocess.py @@ -45,7 +45,8 @@ def tor_delete(self): if self.use_log: self.tl.debug('Hash list submitted for deletion:') self.tl.debug(self.torrent_hash_delete_list) - self.qbt_client.torrents_delete(True, self.torrent_hash_delete_list) + if self.torrent_hash_delete_list: + self.qbt_client.torrents_delete(True, self.torrent_hash_delete_list) def is_downloading(state): if state == 'downloading':