Add mapping table loading exception handling
This commit is contained in:
@@ -13,6 +13,7 @@ import platform
|
|||||||
import config
|
import config
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from lxml import etree
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from opencc import OpenCC
|
from opencc import OpenCC
|
||||||
|
|
||||||
@@ -575,11 +576,16 @@ def main(args: tuple) -> Path:
|
|||||||
else:
|
else:
|
||||||
print(f"[-] [{i}/{len(res)}] Mapping Table Download failed")
|
print(f"[-] [{i}/{len(res)}] Mapping Table Download failed")
|
||||||
except:
|
except:
|
||||||
print("[!]======================= WARNING ======================")
|
print("[!]" + " WARNING ".center(54, "="))
|
||||||
print('[!]' + '-- GITHUB CONNECTION FAILED --'.center(54))
|
print('[!]' + '-- GITHUB CONNECTION FAILED --'.center(54))
|
||||||
print('[!]' + 'Failed to check for updates'.center(54))
|
print('[!]' + 'Failed to check for updates'.center(54))
|
||||||
print('[!]' + '& update the mapping table'.center(54))
|
print('[!]' + '& update the mapping table'.center(54))
|
||||||
print("[!]======================================================")
|
print("[!]" + "".center(54, "="))
|
||||||
|
try:
|
||||||
|
etree.parse(str(Path.home() / '.local' / 'share' / 'mdc' / 'mapping_actor.xml'))
|
||||||
|
except:
|
||||||
|
print('[!]' + "Failed to load mapping table".center(54))
|
||||||
|
print('[!]' + "".center(54, "="))
|
||||||
|
|
||||||
create_failed_folder(conf.failed_folder())
|
create_failed_folder(conf.failed_folder())
|
||||||
|
|
||||||
|
|||||||
@@ -30,9 +30,12 @@ def get_data_from_json(
|
|||||||
:param specified_url: 指定的数据查询地址, 目前未使用
|
:param specified_url: 指定的数据查询地址, 目前未使用
|
||||||
:return 给定影片名称的具体信息
|
:return 给定影片名称的具体信息
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
actor_mapping_data = etree.parse(str(Path.home() / '.local' / 'share' / 'mdc' / 'mapping_actor.xml'))
|
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'))
|
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()
|
conf = config.getInstance()
|
||||||
# default fetch order list, from the beginning to the end
|
# default fetch order list, from the beginning to the end
|
||||||
|
|||||||
Reference in New Issue
Block a user