give downloader classes proper names

This commit is contained in:
Mike Fährmann
2018-11-16 14:40:05 +01:00
parent 3c25fa2dad
commit b17a5d6f3b
4 changed files with 13 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ def find(scheme):
try:
if "." not in scheme: # prevent relative imports
module = importlib.import_module("." + scheme, __package__)
klass = module.Downloader
klass = module.__downloader__
except (ImportError, AttributeError, TypeError):
pass
_cache[scheme] = klass

View File

@@ -15,7 +15,7 @@ from .common import DownloaderBase
from .. import text, exception
class Downloader(DownloaderBase):
class HttpDownloader(DownloaderBase):
scheme = "http"
def __init__(self, extractor, output):
@@ -123,3 +123,6 @@ MIMETYPE_MAP = {
"application/ogg": "ogg",
"application/octet-stream": "bin",
}
__downloader__ = HttpDownloader

View File

@@ -11,7 +11,7 @@
from .common import DownloaderBase
class Downloader(DownloaderBase):
class TextDownloader(DownloaderBase):
scheme = "text"
def __init__(self, extractor, output):
@@ -32,3 +32,6 @@ class Downloader(DownloaderBase):
@staticmethod
def get_extension():
return "txt"
__downloader__ = TextDownloader

View File

@@ -14,7 +14,7 @@ from .. import text
import os
class Downloader(DownloaderBase):
class YoutubeDLDownloader(DownloaderBase):
scheme = "ytdl"
def __init__(self, extractor, output):
@@ -70,3 +70,6 @@ class Downloader(DownloaderBase):
for entry in info_dict["entries"]:
self.ytdl.process_info(entry)
return True
__downloader__ = YoutubeDLDownloader