2017-12-29 22:54:22 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- encoding: utf-8 -*-
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
modules_map = dict()
|
|
|
|
|
|
|
|
moduleNames = os.listdir(os.path.join(os.path.dirname(os.path.abspath(__file__)),'modules'))
|
|
|
|
moduleNames = list(map(lambda a: a[:-3], filter(lambda a: a.endswith('.py'), moduleNames)))
|
|
|
|
|
|
|
|
for moduleName in moduleNames:
|
2020-05-13 21:07:05 +00:00
|
|
|
if not moduleName.startswith('_'):
|
|
|
|
exec('from .modules import {0} as {0}; modules_map["{0}"] = {0}'.format(moduleName))
|
2017-12-29 22:54:22 +00:00
|
|
|
|
|
|
|
def getDownloader(domain):
|
|
|
|
for module in modules_map.values():
|
|
|
|
try:
|
|
|
|
if module.works_on(domain):
|
|
|
|
return module.get_class()
|
|
|
|
except: pass
|
|
|
|
return None
|
|
|
|
|