1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

chg: dev: fix error (#32)

* fix: dev: error

* fix: dev: AttributeError when getting artist

* fix: dev: typo on luscious parser
This commit is contained in:
rachmadani haryono 2017-08-04 21:01:10 +08:00 committed by Mike Fährmann
parent c4713404c8
commit dcd573806e
2 changed files with 6 additions and 1 deletions

View File

@ -62,7 +62,10 @@ class LusciousAlbumExtractor(AsynchronousExtractor):
("language", '<p>Language:', ' '),
), values={"gallery-id": self.gid})[0]
data["lang"] = util.language_to_code(data["language"] or "", None)
data["artist"] = text.extract(data["tags"], "rtist: ", ",")[0] or None
try:
data["artist"] = text.extract(data["tags"], "rtist: ", ",")[0] or None
except AttributeError:
data["artist"] = None
self.section = data["com"]
del data["com"]
return data

View File

@ -87,6 +87,8 @@ def code_to_language(code, default="English"):
def language_to_code(lang, default="en"):
"""Map a language name to its ISO 639-1 code"""
if lang is None:
return None
lang = lang.capitalize()
for code, language in CODES.items():
if language == lang: