From dcd573806ec80fd95a93fe83aecd71b0e8265031 Mon Sep 17 00:00:00 2001 From: rachmadani haryono Date: Fri, 4 Aug 2017 21:01:10 +0800 Subject: [PATCH] chg: dev: fix error (#32) * fix: dev: error * fix: dev: AttributeError when getting artist * fix: dev: typo on luscious parser --- gallery_dl/extractor/luscious.py | 5 ++++- gallery_dl/util.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/luscious.py b/gallery_dl/extractor/luscious.py index 6d8dffc5..bf0a089b 100644 --- a/gallery_dl/extractor/luscious.py +++ b/gallery_dl/extractor/luscious.py @@ -62,7 +62,10 @@ class LusciousAlbumExtractor(AsynchronousExtractor): ("language", '

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 diff --git a/gallery_dl/util.py b/gallery_dl/util.py index 9cd223b9..7271674e 100644 --- a/gallery_dl/util.py +++ b/gallery_dl/util.py @@ -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: