run method
(self)
| 162 | |
| 163 | #---------------------------------------------------------------------- |
| 164 | def run(self): |
| 165 | """run method""" |
| 166 | pyfile = None |
| 167 | |
| 168 | while True: |
| 169 | del pyfile |
| 170 | self.active = self.queue.get() |
| 171 | pyfile = self.active |
| 172 | |
| 173 | if self.active == "quit": |
| 174 | self.active = False |
| 175 | self.m.threads.remove(self) |
| 176 | return True |
| 177 | |
| 178 | try: |
| 179 | if not pyfile.hasPlugin(): continue |
| 180 | #this pyfile was deleted while queueing |
| 181 | |
| 182 | pyfile.plugin.checkForSameFiles(starting=True) |
| 183 | self.m.log.info(_("Download starts: %s" % pyfile.name)) |
| 184 | |
| 185 | # start download |
| 186 | self.m.core.hookManager.downloadPreparing(pyfile) |
| 187 | pyfile.plugin.preprocessing(self) |
| 188 | |
| 189 | self.m.log.info(_("Download finished: %s") % pyfile.name) |
| 190 | self.m.core.hookManager.downloadFinished(pyfile) |
| 191 | self.m.core.files.checkPackageFinished(pyfile) |
| 192 | |
| 193 | except NotImplementedError: |
| 194 | self.m.log.error(_("Plugin %s is missing a function.") % pyfile.pluginname) |
| 195 | pyfile.setStatus("failed") |
| 196 | pyfile.error = "Plugin does not work" |
| 197 | self.clean(pyfile) |
| 198 | continue |
| 199 | |
| 200 | except Abort: |
| 201 | try: |
| 202 | self.m.log.info(_("Download aborted: %s") % pyfile.name) |
| 203 | except: |
| 204 | pass |
| 205 | |
| 206 | pyfile.setStatus("aborted") |
| 207 | |
| 208 | self.clean(pyfile) |
| 209 | continue |
| 210 | |
| 211 | except Reconnect: |
| 212 | self.queue.put(pyfile) |
| 213 | #pyfile.req.clearCookies() |
| 214 | |
| 215 | while self.m.reconnecting.isSet(): |
| 216 | sleep(0.5) |
| 217 | |
| 218 | continue |
| 219 | |
| 220 | except Retry, e: |
| 221 | reason = e.args[0] |
nothing calls this directly
no test coverage detected