forked from sleikang/media_server_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
30 lines (26 loc) · 1.14 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import time
from media import media
from system.config import config
from system.log import log
if __name__ == '__main__':
try:
if 'MEDIASERVERTOOLS_CONFIG' not in os.environ:
if 'EMBYTOOLS_CONFIG' in os.environ:
path = os.environ['EMBYTOOLS_CONFIG']
else:
path = os.path.join(os.getcwd(), 'config')
os.environ['MEDIASERVERTOOLS_CONFIG'] = path
path = os.path.join(os.environ['MEDIASERVERTOOLS_CONFIG'], 'config.yaml')
configinfo = config(path=path)
mediaclient = media(configinfo=configinfo)
while True:
try:
log().info('开始刷新媒体库元数据')
mediaclient.start_scan_media()
log().info('刷新媒体库元数据完成')
time.sleep(configinfo.systemdata['updatetime'] * 3600)
except Exception as result:
log().info(result)
except Exception as result:
log().info("文件[{}]行[{}]异常错误:{}".format(result.__traceback__.tb_frame.f_globals["__file__"], result.__traceback__.tb_lineno, result))