Add mapping table loading exception handling

This commit is contained in:
yoshiko2
2023-05-09 01:23:26 +08:00
parent f9440cf1f1
commit 7dcc4c218f
2 changed files with 14 additions and 5 deletions

View File

@@ -30,9 +30,12 @@ def get_data_from_json(
:param specified_url: 指定的数据查询地址, 目前未使用
:return 给定影片名称的具体信息
"""
actor_mapping_data = etree.parse(str(Path.home() / '.local' / 'share' / 'mdc' / 'mapping_actor.xml'))
info_mapping_data = etree.parse(str(Path.home() / '.local' / 'share' / 'mdc' / 'mapping_info.xml'))
try:
actor_mapping_data = etree.parse(str(Path.home() / '.local' / 'share' / 'mdc' / 'mapping_actor.xml'))
info_mapping_data = etree.parse(str(Path.home() / '.local' / 'share' / 'mdc' / 'mapping_info.xml'))
except:
actor_mapping_data = etree.fromstring("<html></html>", etree.HTMLParser())
info_mapping_data = etree.fromstring("<html></html>", etree.HTMLParser())
conf = config.getInstance()
# default fetch order list, from the beginning to the end