adjust loader to new config-interface
This commit is contained in:
@@ -9,9 +9,8 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import importlib
|
import importlib
|
||||||
from . import extractor
|
from . import config, extractor
|
||||||
from .extractor.common import Message
|
from .extractor.common import Message
|
||||||
from . import config
|
|
||||||
|
|
||||||
class DownloadManager():
|
class DownloadManager():
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ class DownloadJob():
|
|||||||
|
|
||||||
def __init__(self, mngr, url):
|
def __init__(self, mngr, url):
|
||||||
self.mngr = mngr
|
self.mngr = mngr
|
||||||
self.extractor, self.info = extractor.find(url, mngr.config)
|
self.extractor, self.info = extractor.find(url)
|
||||||
if self.extractor is None:
|
if self.extractor is None:
|
||||||
return
|
return
|
||||||
self.directory = mngr.get_base_directory()
|
self.directory = mngr.get_base_directory()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import importlib
|
|||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
"pixiv",
|
"pixiv",
|
||||||
"exhentai",
|
# "exhentai",
|
||||||
"gelbooru",
|
"gelbooru",
|
||||||
"3dbooru",
|
"3dbooru",
|
||||||
"4chan",
|
"4chan",
|
||||||
@@ -28,12 +28,12 @@ modules = [
|
|||||||
"yandere",
|
"yandere",
|
||||||
]
|
]
|
||||||
|
|
||||||
def find(url, config):
|
def find(url):
|
||||||
"""Find extractor suitable for handling the given url"""
|
"""Find extractor suitable for handling the given url"""
|
||||||
for pattern, module, klass in _list_patterns():
|
for pattern, module, klass in _list_patterns():
|
||||||
match = re.match(pattern, url)
|
match = re.match(pattern, url)
|
||||||
if match:
|
if match:
|
||||||
return klass(match, config), module.info
|
return klass(match), module.info
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
# internals
|
# internals
|
||||||
|
|||||||
Reference in New Issue
Block a user