Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
cctv兼容
Browse files Browse the repository at this point in the history
  • Loading branch information
hjdhnx committed Jan 7, 2024
1 parent df0eca5 commit eea8955
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion base/custom.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"searchable":1,
"quickSearch":1,
"filterable":1,
"ext":"./cctv_spider.json",
"ext":"cctv_spider",
},
{
"key": "t3_hipy_cctv",
Expand Down
2 changes: 1 addition & 1 deletion js/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.49beta14
3.9.49beta15
23 changes: 16 additions & 7 deletions txt/hipy/cctv_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@

"""
配置示例:
t4不支持ext,api里会自动含有ext参数是base64编码后的选中的筛选条件
t4的配置里ext节点会自动变成api对应query参数extend,但t4的ext字符串不支持路径格式,比如./开头或者.json结尾
api里会自动含有ext参数是base64编码后的选中的筛选条件
错误示例,ext含有json:
{
"key":"hipy_cctv",
"name":"hipy_cctv",
"type":4,
"api":"http://192.168.31.49:5707/api/v1/vod/cctv_spider?api_ext=./cctv_spider.json",
"api":"http://192.168.31.49:5707/api/v1/vod/cctv_spider?api_ext={{host}}/txt/hipy/cctv_spider.json",
"searchable":1,
"quickSearch":1,
"filterable":1,
"ext":"./cctv_spider.json"
"ext":"cctv_spider.json"
}
正确示例。同时存在ext和api_ext会优先取ext作为extend加载init
{
"key":"hipy_cctv",
"name":"hipy_cctv",
Expand All @@ -41,6 +43,7 @@
"searchable":1,
"quickSearch":1,
"filterable":1,
"ext":"cctv_spider"
}
{
Expand Down Expand Up @@ -194,9 +197,7 @@ def init_api_ext_file(self):
f.write(json.dumps(ext_file_dict, ensure_ascii=False))

def init(self, extend=""):
print("============{0}============".format(extend))
if extend.startswith('./'):
ext_file = os.path.join(os.path.dirname(__file__), extend)
def init_file(ext_file):
ext_file = Path(ext_file).as_posix()
# print(f'ext_file:{ext_file}')
if os.path.exists(ext_file):
Expand All @@ -208,12 +209,20 @@ def init(self, extend=""):
self.config['filter'].update(ext_dict)
except Exception as e:
print(f'更新扩展筛选条件发生错误:{e}')

print("============{0}============".format(extend))
if extend.startswith('./'):
ext_file = os.path.join(os.path.dirname(__file__), extend)
init_file(ext_file)
elif extend.startswith('http'):
try:
r = self.fetch(extend)
self.config['filter'].update(r.json())
except Exception as e:
print(f'更新扩展筛选条件发生错误:{e}')
elif extend and not extend.startswith('./') and not extend.startswith('http'):
ext_file = os.path.join(os.path.dirname(__file__), './' + extend + '.json')
init_file(ext_file)

def isVideoFormat(self, url):
pass
Expand Down

0 comments on commit eea8955

Please sign in to comment.