提交 2590e86f 编写于 作者: H hjdhnx

优化打印

上级 260c32f8
......@@ -35,8 +35,9 @@ def create_flask_app(config):
print('当前操作系统', sys.platform)
app.logger.name = "drLogger"
rule_list = getRuleLists()
wlan_info,_ = get_wlan_info()
logger.info(rule_list)
logger.info(f'局域网: {getHost(1, 5705)}/index\n本地: {getHost(0, 5705)}/index')
logger.info(f'局域网: {getHost(1, 5705)}/index\n本地: {getHost(0, 5705)}\nwlan_info:{wlan_info}/index')
return app
app = create_flask_app(config)
......
......@@ -466,13 +466,14 @@ class CMS:
})
except:
pass
result['list'] = videos
result['list'] = videos[min((fypage-1)*self.limit,len(videos)-1):min(fypage*self.limit,len(videos))]
result['code'] = 1
result['msg'] = '数据列表'
result['page'] = fypage
result['pagecount'] = math.ceil(len(videos)/self.limit)
result['limit'] = self.limit
result['total'] = len(videos)
result['now_count'] = len(result['list'])
return result
except Exception as e:
logger.info(f'首页内容获取失败:{e}')
......@@ -703,7 +704,7 @@ class CMS:
:return:
"""
t1 = time()
array = array[(fypage-1)*self.limit:min(self.limit*fypage,len(array))]
array = array if len(array) <= self.limit else array[(fypage-1)*self.limit:min(self.limit*fypage,len(array))]
thread_pool = ThreadPoolExecutor(min(self.limit,len(array))) # 定义线程池来启动多线程执行此任务
obj_list = []
try:
......
......@@ -49,6 +49,7 @@
###### 2022/09/04
- [X] 1.内置jar修复了原本tv_box无法播放直播的问题
- [X] 2.重新构建了三种平台的镜像 amd64,armv7,arm64
- [X] 3.优化日志打印wlan信息
###### 2022/09/04
- [X] 1.增加了dockerfile
- [X] 2.基于dockerfile构建的镜像并上传至dockerhub,小白可以一键运行.参考[搭建教程](./安卓本地搭建说明.md)
......
......@@ -43,6 +43,13 @@ def get_host_ip_old(): # 获取局域网ip
return real_ips[-1] if len(jyw) < 1 else jyw[0]
def get_host_ip(): # 获取局域网ip
netcard_info,ips = get_wlan_info()
# print(netcard_info)
real_ips = list(filter(lambda x: x and x != '127.0.0.1', ips))
jyw = list(filter(lambda x: str(x).startswith('192.168'), real_ips))
return real_ips[-1] if len(jyw) < 1 else jyw[0]
def get_wlan_info():
info = psutil.net_if_addrs()
# print(info)
netcard_info = []
......@@ -52,10 +59,7 @@ def get_host_ip(): # 获取局域网ip
if item[0] == 2:
netcard_info.append((k, item[1]))
ips.append(item[1])
print(netcard_info)
real_ips = list(filter(lambda x: x and x != '127.0.0.1', ips))
jyw = list(filter(lambda x: str(x).startswith('192.168'), real_ips))
return real_ips[-1] if len(jyw) < 1 else jyw[0]
return netcard_info,ips
def getHost(mode=0,port=None):
port = port or request.environ.get('SERVER_PORT')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册