电视直播功能增强

This commit is contained in:
hjdhnx 2023-11-22 22:40:45 +08:00
parent 7368689b99
commit 291d1b31b5
10 changed files with 3226 additions and 3066 deletions

File diff suppressed because it is too large Load Diff

View File

@ -552,3 +552,31 @@ def admin_lives():
response = make_response(files)
response.headers['Content-Type'] = 'text/plain; charset=utf-8'
return response
@admin.route('/lives_web')
def admin_lives_web():
if not verfy_token():
return R.failed('请登录后再试')
# host_url = request.host_url
def get_lives():
base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 上级目录
live_path = os.path.join(base_path, f'base/直播.txt')
with open(live_path,encoding='utf-8') as f:
text = f.read()
return text
text = get_lives()
# response = make_response(text)
# response.headers['Content-Type'] = 'text/plain; charset=utf-8'
# return response
lives = []
for line in text.split('\n'):
if ',http' in line:
lives.append({
'title':line.split(',')[0],
'url':line.split(',')[1],
})
print(lives)
# lsg = storage_service()
return render_template('lives.html',ver=getLocalVer(),lives=lives)

View File

@ -71,15 +71,18 @@ def rules_to_view():
def random_pics():
id = getParmas('id')
# print(f'id:{id}')
pics = getPics()
base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 上级目录
path = 'images'
img_path = os.path.join(base_path, f'{path}')
pics = getPics(img_path)
# print(pics)
new_conf = cfg
lsg = storage_service()
store_conf_dict = lsg.getStoreConfDict()
new_conf.update(store_conf_dict)
if not new_conf.WALL_PAPER and len(pics) > 0:
if id and f'images/{id}.jpg' in pics:
pic = f'images/{id}.jpg'
if not new_conf.WALL_PAPER or (id and len(pics) > 0):
if id and f'{img_path}/{id}.jpg' in pics:
pic = f'{img_path}/{id}.jpg'
else:
pic = random.choice(pics)
file = open(pic, "rb").read()

View File

@ -1,3 +1,6 @@
###### 2023/11/22
- [X] 3.9.49beta1 增加网页直播功能
###### 2023/11/18
- [X] 修复腾云驾雾
- [X] 增加手动升级功能,手动上传升级文件.zip后进行强制升级即可

BIN
images/odoo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

BIN
images/zb.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

View File

@ -1 +1 @@
3.9.48beta29
3.9.49beta1

View File

@ -298,6 +298,10 @@
$('#lives').click(function () {
location.href = '/admin/lives'
});
$('#lives_web').click(function () {
location.href = '/admin/lives_web'
});
$("summary").click(function() {
// console.log('summary被点击');
const details = $('details');
@ -360,6 +364,7 @@
<li><a href="javascript:void(0);" class="funcbtn" id="update_lives">同步直播源</a></li>
<li><a href="javascript:void(0);" class="funcbtn" id="use_py">已{% if pystate=='1' %}启用{% else %}关闭{% endif %}py源</a></li>
<li><a href="javascript:void(0);" class="funcbtn" id="lives">直播源列表</a></li>
<li><a href="javascript:void(0);" class="funcbtn" id="lives_web">网页在线直播</a></li>
</ul>
</li>

63
templates/lives.html Normal file
View File

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<title>电视直播页面-{{ver}}</title>
<meta charset="UTF-8"> <!-- 设置字符编码为UTF-8 -->
<meta name="description" content="drpy在线电视直播by道长">
<meta name="author" content="道长" />
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">-->
<link rel="stylesheet" media="screen" href="/static/css/admin.css">
<link rel="icon" href="/static/img/logo.png" type="image/x-icon">
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/common.js"></script>
<script src="/static/js/grey.js"></script>
<style>
.container {
text-align: center; /* 设置文本居中对齐,将块水平居中 */
}
.block {
display: inline-block; /* 将块设置为行内块元素,每行显示两个 */
width: 300px; /* 每个块的宽度,可以根据需要自定义 */
margin: 20px;
padding: 10px;
border: 1px solid #d5d1d1;
border-radius: 10px; /* 设置圆角半径为10px */
text-align: center; /* 使块内文本左对齐 */
background: rgb(71, 143, 250,0.8); /* 背景颜色 */
opacity: 0.8; /* 透明度 */
}
.block h2 {
color: rgb(254, 254, 254); /* 设置文字颜色为红色 */
}
.block img {
max-width: 100%;
height: auto; /* 保持图片宽高比例 */
}
body {
background-image: url("/pics?id=zb"); /* 设置背景图像的URL */
background-size: cover; /* 使图像覆盖整个页面,不变形 */
background-repeat: no-repeat; /* 防止图像重复平铺 */
background-attachment: fixed; /* 固定背景图像,使其在滚动时保持固定 */
background-position: center center; /* 居中显示背景图像 */
}
</style>
</head>
<body>
<div class="container">
{% for live in lives %}
<div class="block">
<a href="/web/player1?url={{ live.url }}" target="_blank">
<h2>{{ live.title }}</h2>
</a>
</div>
{% endfor %}
<!-- 可以根据需要添加更多块 -->
</div>
</body>
</html>

3061
txt/lives/zb_drpy.txt Normal file

File diff suppressed because it is too large Load Diff