MCPcopy
hub / github.com/pyload/pyload / extract

Method extract

module/plugins/hooks/ExtractArchive.py:216–404  ·  view source on GitHub ↗
(self, ids, thread=None)

Source from the content-addressed store, hash-verified

214
215 @Expose
216 def extract(self, ids, thread=None): # @TODO: Use pypack, not pid to improve method usability
217 if not ids:
218 return False
219
220 extracted = []
221 failed = []
222
223 toList = lambda string: string.replace(' ', '').replace(',','|').replace(';', '|').split('|')
224
225 destination = self.config.get('destination')
226 subfolder = self.config.get('subfolder')
227 fullpath = self.config.get('fullpath')
228 overwrite = self.config.get('overwrite')
229 priority = self.config.get('priority')
230 recursive = self.config.get('recursive')
231 keepbroken = self.config.get('keepbroken')
232
233 extensions = [x.lstrip('.').lower()
234 for x in toList(self.config.get('extensions'))]
235 excludefiles = toList(self.config.get('excludefiles'))
236
237 if extensions:
238 self.log_debug("Use for extensions: .%s" % "|.".join(extensions))
239
240 #: Reload from txt file
241 self.reload_passwords()
242
243 dl_folder = self.pyload.config.get("general", "download_folder")
244
245 #: Iterate packages -> extractors -> targets
246 for pid in ids:
247 pypack = self.pyload.files.getPackage(pid)
248
249 if not pypack:
250 self.queue.remove(pid)
251 continue
252
253 self.log_info(_("Check package: %s") % pypack.name)
254
255 pack_dl_folder = fsjoin(
256 dl_folder,
257 pypack.folder,
258 "") #: Force trailing slash
259
260 #: Determine output folder
261 extract_folder = fsjoin(
262 pack_dl_folder,
263 destination,
264 "") #: Force trailing slash
265
266 if subfolder:
267 extract_folder = fsjoin(extract_folder,
268 pypack.folder or safename(pypack.name.replace("http://", "")))
269
270 if not exists(extract_folder):
271 os.makedirs(extract_folder)
272
273 if subfolder:

Callers 2

extract_queuedMethod · 0.95
_extractMethod · 0.45

Calls 15

reload_passwordsMethod · 0.95
chunksMethod · 0.95
_extractMethod · 0.95
fsjoinFunction · 0.85
safenameFunction · 0.85
existsFunction · 0.85
dictFunction · 0.85
filterFunction · 0.85
ExtractorClass · 0.85
splitMethod · 0.80
log_debugMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected