initial support for extractor-subcategories
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
{
|
||||
"pixiv":
|
||||
{
|
||||
"directory": ["{category}", "{artist-id}"],
|
||||
"directory_fmt": ["{category}", "{artist-id}"],
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
@@ -27,19 +27,13 @@
|
||||
"nijie_login_hash": null
|
||||
}
|
||||
},
|
||||
"danbooru":
|
||||
{
|
||||
"pattern": ["d(?:anbooru)?[.:-_](\\w.+)"],
|
||||
"filename": "{category}_{id:>07}_{md5}.{extension}"
|
||||
},
|
||||
"gelbooru":
|
||||
{
|
||||
"pattern": ["g(?:elbooru)?[.:-_](\\w.+)"],
|
||||
"filename": "{category}_{id:>07}_{md5}.{extension}",
|
||||
"filename_fmt": "{category}_{id:>07}_{md5}.{extension}",
|
||||
"cookies":
|
||||
{
|
||||
"user_id": null,
|
||||
"pass_hash": null,
|
||||
"pass_hash": null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ from .. import config
|
||||
|
||||
class Extractor():
|
||||
|
||||
category = ""
|
||||
subcategory = ""
|
||||
directory_fmt = [""]
|
||||
filename_fmt = ""
|
||||
|
||||
|
||||
@@ -22,13 +22,14 @@ class DownloadJob():
|
||||
self.directory = self.get_base_directory()
|
||||
self.downloaders = {}
|
||||
self.queue = None
|
||||
self.filename_fmt = config.get(
|
||||
("extractor", self.extractor.category, "filename"),
|
||||
default=self.extractor.filename_fmt
|
||||
key = ["extractor", self.extractor.category]
|
||||
if self.extractor.subcategory:
|
||||
key.append(self.extractor.subcategory)
|
||||
self.filename_fmt = config.interpolate(
|
||||
key + ["filename_fmt"], default=self.extractor.filename_fmt
|
||||
)
|
||||
segments = config.get(
|
||||
("extractor", self.extractor.category, "directory"),
|
||||
default=self.extractor.directory_fmt
|
||||
segments = config.interpolate(
|
||||
key + ["directory_fmt"], default=self.extractor.directory_fmt
|
||||
)
|
||||
self.directory_fmt = os.path.join(*segments)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user