修改BUG:程序无法停止

This commit is contained in:
Qiea
2024-12-22 20:36:29 +08:00
parent 383435dc1a
commit f73b40a979
3 changed files with 10 additions and 3 deletions

View File

@@ -86,6 +86,7 @@ class ByNetFindThread(threading.Thread):
self.findqqnumber = findqqnumber self.findqqnumber = findqqnumber
def run(self): def run(self):
logging.debug(f'查找的QQ号是: {self.findqqnumber}')
if download_image(self.findqqnumber): if download_image(self.findqqnumber):
FindImage = Image.open(str(f'./img/{self.findqqnumber}.jpg')) FindImage = Image.open(str(f'./img/{self.findqqnumber}.jpg'))
if FindImage.mode == 'P' and 'transparency' in FindImage.info: if FindImage.mode == 'P' and 'transparency' in FindImage.info:

View File

@@ -1,6 +1,6 @@
[settings] [settings]
type = 2 type = 2
TargetRange = 2787071343, 2787091343 TargetRange = 2787080000, 2787083000
TargetImage = ./img/target4.jpg TargetImage = ./img/target4.jpg
[mysql] [mysql]
@@ -14,7 +14,7 @@ hash_column_name = hash
pool_size = 100 pool_size = 100
[logging] [logging]
level = 20 level = 10
;CRITICAL = 50 ;CRITICAL = 50
;FATAL = CRITICAL ;FATAL = CRITICAL

View File

@@ -1,3 +1,4 @@
from time import sleep
from Thread import UploadThread, FindThread, ByNetFindThread, MySQLConnectionPool from Thread import UploadThread, FindThread, ByNetFindThread, MySQLConnectionPool
from Tools import imagehash, Image, os, config from Tools import imagehash, Image, os, config
@@ -16,12 +17,16 @@ if __name__ == '__main__':
pool = MySQLConnectionPool() pool = MySQLConnectionPool()
Thread = FindThread(TargetImageHash, pool) Thread = FindThread(TargetImageHash, pool)
Thread.start() Thread.start()
os._exit(0)
elif type == 2: elif type == 2:
while baseArr < TargetRange[1]: while baseArr <= TargetRange[1]:
Thread = ByNetFindThread(TargetImageHash, baseArr) Thread = ByNetFindThread(TargetImageHash, baseArr)
Thread.start() Thread.start()
baseArr += 1 baseArr += 1
sleep(1)
os._exit(0)
elif type == 3: elif type == 3:
pool = MySQLConnectionPool() pool = MySQLConnectionPool()
@@ -29,3 +34,4 @@ if __name__ == '__main__':
Thread = UploadThread(baseArr, pool) Thread = UploadThread(baseArr, pool)
Thread.start() Thread.start()
baseArr += 1 baseArr += 1
os._exit(0)