Constructor
(self, core)
| 39 | |
| 40 | |
| 41 | def __init__(self, core): |
| 42 | """Constructor""" |
| 43 | self.core = core |
| 44 | self.log = core.log |
| 45 | |
| 46 | self.threads = [] # thread list |
| 47 | self.localThreads = [] #hook+decrypter threads |
| 48 | |
| 49 | self.pause = True |
| 50 | |
| 51 | self.reconnecting = Event() |
| 52 | self.reconnecting.clear() |
| 53 | self.downloaded = 0 #number of files downloaded since last cleanup |
| 54 | |
| 55 | self.lock = Lock() |
| 56 | |
| 57 | # some operations require to fetch url info from hoster, so we caching them so it wont be done twice |
| 58 | # contains a timestamp and will be purged after timeout |
| 59 | self.infoCache = {} |
| 60 | |
| 61 | # pool of ids for online check |
| 62 | self.resultIDs = 0 |
| 63 | |
| 64 | # threads which are fetching hoster results |
| 65 | self.infoResults = {} |
| 66 | #timeout for cache purge |
| 67 | self.timestamp = 0 |
| 68 | |
| 69 | pycurl.global_init(pycurl.GLOBAL_DEFAULT) |
| 70 | |
| 71 | for i in range(0, self.core.config.get("download", "max_downloads")): |
| 72 | self.createThread() |
| 73 | |
| 74 | |
| 75 | def createThread(self): |
nothing calls this directly
no test coverage detected