[mangadex] allow multiple values for 'lang' (#4093)

This was already possible by setting 'lang' to a list of strings,
but now it can also be done as a more command-line friendly string.

-o lang=fr,it
pull/4403/head
Mike Fährmann 1 year ago
parent 52053b58f0
commit 1ece3b92ff
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -2093,11 +2093,14 @@ Description
extractor.mangadex.lang
-----------------------
Type
``string``
* ``string``
* ``list`` of ``strings``
Example
``"en"``
* ``"en"``
* ``"fr,it"``
* ``["fr", "it"]``
Description
`ISO 639-1 <https://en.wikipedia.org/wiki/ISO_639-1>`__ language code
`ISO 639-1 <https://en.wikipedia.org/wiki/ISO_639-1>`__ language codes
to filter chapters by.

@ -150,6 +150,7 @@ class MangadexMangaExtractor(MangadexExtractor):
pattern = BASE_PATTERN + r"/(?:title|manga)/(?!feed$)([0-9a-f-]+)"
test = (
("https://mangadex.org/title/f90c4398-8aad-4f51-8a1f-024ca09fdcbc", {
"count": ">= 5",
"keyword": {
"manga" : "Souten no Koumori",
"manga_id": "f90c4398-8aad-4f51-8a1f-024ca09fdcbc",
@ -168,6 +169,16 @@ class MangadexMangaExtractor(MangadexExtractor):
"Martial Arts", "Drama", "Tragedy"],
},
}),
# mutliple values for 'lang' (#4093)
("https://mangadex.org/title/f90c4398-8aad-4f51-8a1f-024ca09fdcbc", {
"options": (("lang", "fr,it"),),
"count": 2,
"keyword": {
"manga" : "Souten no Koumori",
"lang" : "re:fr|it",
"language": "re:French|Italian",
},
}),
("https://mangadex.cc/manga/d0c88e3b-ea64-4e07-9841-c1d2ac982f4a/", {
"options": (("lang", "en"),),
"count": ">= 100",
@ -290,9 +301,13 @@ class MangadexAPI():
if ratings is None:
ratings = ("safe", "suggestive", "erotica", "pornographic")
lang = config("lang")
if isinstance(lang, str) and "," in lang:
lang = lang.split(",")
params["contentRating[]"] = ratings
params["translatedLanguage[]"] = lang
params["includes[]"] = ("scanlation_group",)
params["translatedLanguage[]"] = config("lang")
params["offset"] = 0
api_params = config("api-parameters")

Loading…
Cancel
Save