mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-07-19 05:19:40 +02:00
config number of threads
This commit is contained in:
parent
c265840ca2
commit
e8d019b9a5
5 changed files with 14 additions and 4 deletions
|
@ -19,3 +19,5 @@ QUARANTINE = True
|
|||
; Set quarantine folder
|
||||
QUARANTINE_FOLDER = /var/quarantine
|
||||
|
||||
; Maximum number of threads
|
||||
THREADS = 2
|
||||
|
|
|
@ -19,3 +19,5 @@ QUARANTINE = True
|
|||
; Set quarantine folder
|
||||
QUARANTINE_FOLDER = /var/quarantine
|
||||
|
||||
; Maximum number of threads
|
||||
THREADS = 4
|
||||
|
|
|
@ -19,3 +19,5 @@ QUARANTINE = True
|
|||
; Set quarantine folder
|
||||
QUARANTINE_FOLDER = /var/quarantine
|
||||
|
||||
; Maximum number of threads
|
||||
THREADS = 1
|
||||
|
|
|
@ -19,3 +19,5 @@ QUARANTINE = True
|
|||
; Set quarantine folder
|
||||
QUARANTINE_FOLDER = /var/quarantine
|
||||
|
||||
; Maximum number of threads
|
||||
THREADS = 4
|
||||
|
|
|
@ -37,7 +37,6 @@ import pypandora
|
|||
# -----------------------------------------------------------
|
||||
# Threading variables
|
||||
# -----------------------------------------------------------
|
||||
maxThread = 24
|
||||
threads = []
|
||||
exitFlag = False
|
||||
queueLock = threading.Lock()
|
||||
|
@ -52,6 +51,7 @@ pandora_root_url = None
|
|||
has_quarantine = None
|
||||
quarantine_folder = None
|
||||
has_curses = None
|
||||
maxThreads = None
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Curses
|
||||
|
@ -173,7 +173,8 @@ class scanThread (threading.Thread):
|
|||
# ----------------------------------------------------------
|
||||
|
||||
def config():
|
||||
global is_fake_scan, has_usb_auto_mount, pandora_root_url, has_quarantine, quarantine_folder, has_curses
|
||||
global is_fake_scan, has_usb_auto_mount, pandora_root_url
|
||||
global has_quarantine, quarantine_folder, has_curses, maxThreads
|
||||
""" read configuration file """
|
||||
# intantiate a ConfirParser
|
||||
config_parser = configparser.ConfigParser()
|
||||
|
@ -188,7 +189,8 @@ def config():
|
|||
quarantine_folder = config_parser['DEFAULT']['QUARANTINE_FOLDER']
|
||||
# Curses
|
||||
has_curses = config_parser['DEFAULT']['CURSES'].lower() == "true"
|
||||
print(f'has_curses={has_curses}')
|
||||
# MaxThreads
|
||||
maxThreads = int(config_parser['DEFAULT']['THREADS'])
|
||||
|
||||
|
||||
# ----------------------------------------------------------
|
||||
|
@ -559,7 +561,7 @@ def scan():
|
|||
exitFlag = False
|
||||
|
||||
# Instanciate threads
|
||||
for i in range(maxThread):
|
||||
for i in range(maxThreads):
|
||||
thread = scanThread(i)
|
||||
thread.start()
|
||||
threads.append(thread)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue