fixed preme calculation bug and added exec time
This commit is contained in:
parent
fca54f8952
commit
357591227e
10
qbit-maid.py
Executable file → Normal file
10
qbit-maid.py
Executable file → Normal file
@ -6,6 +6,7 @@ from qlist import *
|
|||||||
from qlogging import *
|
from qlogging import *
|
||||||
from qprocess import *
|
from qprocess import *
|
||||||
import time
|
import time
|
||||||
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ class Qbt:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Main object, should be calling functions from qlist.py, qlogging.py and qprocess.py"""
|
"""Main object, should be calling functions from qlist.py, qlogging.py and qprocess.py"""
|
||||||
# Open the config. Needs a json file with the data in config.json.example
|
# Open the config. Needs a json file with the data in config.json.example
|
||||||
|
self.st = datetime.datetime.now()
|
||||||
c = open('./config.json')
|
c = open('./config.json')
|
||||||
self.config = load(c)
|
self.config = load(c)
|
||||||
w = open('./category-whitelist.json')
|
w = open('./category-whitelist.json')
|
||||||
@ -65,6 +67,7 @@ class Qbt:
|
|||||||
# Pulling all torrent data
|
# Pulling all torrent data
|
||||||
self.torrentlist = self.qbt_client.torrents_info()
|
self.torrentlist = self.qbt_client.torrents_info()
|
||||||
#Main process block
|
#Main process block
|
||||||
|
#debugpremecal(self)
|
||||||
if self.use_log:
|
if self.use_log:
|
||||||
listqbitapiinfo(self)
|
listqbitapiinfo(self)
|
||||||
listfirsttor(self)
|
listfirsttor(self)
|
||||||
@ -76,11 +79,12 @@ class Qbt:
|
|||||||
torprocessor(self)
|
torprocessor(self)
|
||||||
if self.use_log:
|
if self.use_log:
|
||||||
printprocessor(self)
|
printprocessor(self)
|
||||||
if self.use_pushover:
|
|
||||||
tornotifysummary(self)
|
|
||||||
if self.config["delete_torrents"]:
|
if self.config["delete_torrents"]:
|
||||||
tordelete(self)
|
tordelete(self)
|
||||||
|
self.et = datetime.datetime.now()
|
||||||
|
getscriptruntime(self)
|
||||||
|
if self.use_pushover:
|
||||||
|
tornotifysummary(self)
|
||||||
# Run
|
# Run
|
||||||
if __name__== "__main__":
|
if __name__== "__main__":
|
||||||
Qbt()
|
Qbt()
|
2
qlist.py
2
qlist.py
@ -9,7 +9,7 @@ def buildtorlist(self):
|
|||||||
torrent = self.torrentlist.pop()
|
torrent = self.torrentlist.pop()
|
||||||
if self.use_log:
|
if self.use_log:
|
||||||
self.tl.debug(f'["{torrent["name"][0:20]}..."] {torrent["infohash_v1"]}')
|
self.tl.debug(f'["{torrent["name"][0:20]}..."] {torrent["infohash_v1"]}')
|
||||||
if torrent['added_on'] + self.minimum_age <= self.t.time():
|
if torrent['added_on'] + self.minimum_age >= self.t.time():
|
||||||
self.preme_tor_counter += 1
|
self.preme_tor_counter += 1
|
||||||
continue
|
continue
|
||||||
if torrent['category'] in self.cat_whitelist.values():
|
if torrent['category'] in self.cat_whitelist.values():
|
||||||
|
16
qlogging.py
16
qlogging.py
@ -39,7 +39,8 @@ def tornotifysummary(self):
|
|||||||
Protected: {self.c[self.tracker_protected_tag]}\n\
|
Protected: {self.c[self.tracker_protected_tag]}\n\
|
||||||
Non-protected: {self.c[self.tracker_non_protected_tag]}\n\
|
Non-protected: {self.c[self.tracker_non_protected_tag]}\n\
|
||||||
Orphaned: {self.up_tor_counter}\n\
|
Orphaned: {self.up_tor_counter}\n\
|
||||||
Marked for deletion: {len(self.torrent_hash_delete_list)}", title="--- qbit-maid summary ---")
|
Marked for deletion: {len(self.torrent_hash_delete_list)}\n\
|
||||||
|
{self.extm}", title="--- qbit-maid summary ---")
|
||||||
|
|
||||||
def getunixtimestamp(self):
|
def getunixtimestamp(self):
|
||||||
"""Used for debuging and development related to unixtimestamps, not used in main script but useful"""
|
"""Used for debuging and development related to unixtimestamps, not used in main script but useful"""
|
||||||
@ -73,3 +74,16 @@ def torrentcount(self):
|
|||||||
|
|
||||||
def torlisttags(self):
|
def torlisttags(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def debugpremecal(self):
|
||||||
|
for torrent in self.torrentlist:
|
||||||
|
if torrent['infohash_v1'] == 'a89b484ea375094af53ce89ecbea14bf086d6284':
|
||||||
|
print(torrent["name"][0:20])
|
||||||
|
print(torrent['added_on'] + self.minimum_age >= self.t.time())
|
||||||
|
|
||||||
|
def getscriptruntime(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}]"
|
Loading…
x
Reference in New Issue
Block a user