Skip to content

Commit d54a605

Browse files
committed
feat: Update Code to V3.1 Ver.
1. Fix code errors. 2. Delete unnecessary files. 3. Add Debian systemctl services demo file. 4. Fix uwsgi.ini
1 parent 4e62e7a commit d54a605

File tree

6 files changed

+101
-66
lines changed

6 files changed

+101
-66
lines changed

static/js/mxd.js

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,28 @@
11
$(function () {
22
$("img.lazy").lazyload();
33
});
4-
function showContent() {
5-
var content = document.getElementById("content");
6-
content.classList.remove("hidden");
7-
}
8-
function toggleContent() {
9-
var content = document.getElementById("content");
10-
var toggleBtn = document.getElementById("toggleBtn");
114

12-
if (content.classList.contains("hidden")) {
13-
content.classList.remove("hidden");
14-
toggleBtn.innerHTML = "点击收起详细内容";
15-
} else {
16-
content.classList.add("hidden");
17-
toggleBtn.innerHTML = "点击显示详细内容";
18-
}
19-
}
5+
window.onload = function() {
6+
const styleTitle1 = "font-size: 22px;font-weight: bold;color: rgb(0,0,139);font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;";
7+
const styleTitle2 = "font-size: 12px;color: rgb(0,0,139);font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;";
8+
const styleContent = "color: rgb(138,43,226);";
9+
const title1 = "Crestekk EPG";
10+
const title2 = `
11+
12+
╔═╗╦═╗╔═╗╔═╗╔╦╗╔═╗╦╔═╦╔═ ╔═╗╔═╗╔═╗
13+
║ ╠╦╝║╣ ╚═╗ ║ ║╣ ╠╩╗╠╩╗ ║╣ ╠═╝║ ╦
14+
╚═╝╩╚═╚═╝╚═╝ ╩ ╚═╝╩ ╩╩ ╩ ╚═╝╩ ╚═╝
2015
21-
window.onload = function () {
22-
const styleTitle1 = "font-size: 22px;font-weight: 600;color: rgb(51,204,255);";
23-
const styleTitle2 = "font-size: 12px;color: rgb(51,51,204);";
24-
const styleContent = "color: rgb(30,152,255);";
25-
const title1 = "mxd's EPG";
26-
const title2 = `
27-
8I dPYb
28-
8I IP Yb
29-
8I I8 8I
30-
8I I8 8
31-
gggg gggg gg gg gggg 8I gg gg ggg gggg gg I8 dPgg
32-
8 8P 8 d8 8b dP dP Y8I I8 8I i8 8i dP Y8I I8dP 8I
33-
I8 8I 8I dP 88 i8 8I I8 8I I8 8I i8 8I I8P I8
34-
dP 8I Yb dP Y8 d8 d8b d8b d8I YbadP d8 d8b d8 I8
35-
8P 8I Y88 dP Y88P Y8888P Y8P Y88P 888888P Y888P Y8888P Y888P 8Y8
36-
d8I
37-
dP 8I
38-
8 8I
39-
I8 8I
40-
8 8I
41-
Y8P `;
42-
const content = `\n\n版本:V3.0-Github \n主页:https://www.mxdyeah.top/ \nGithub:https://github.com/mxdabc/epg`;
16+
17+
███╗ ███╗██╗ ██╗██████╗ ██╗ ██╗███████╗ █████╗ ██╗ ██╗
18+
████╗ ████║╚██╗██╔╝██╔══██╗╚██╗ ██╔╝██╔════╝██╔══██╗██║ ██║
19+
██╔████╔██║ ╚███╔╝ ██║ ██║ ╚████╔╝ █████╗ ███████║███████║
20+
██║╚██╔╝██║ ██╔██╗ ██║ ██║ ╚██╔╝ ██╔══╝ ██╔══██║██╔══██║
21+
██║ ╚═╝ ██║██╔╝ ██╗██████╔╝ ██║ ███████╗██║ ██║██║ ██║
22+
╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
23+
24+
25+
`;
26+
const content = `\n\n版本: V3.1 (Github) \n主页: https://www.mxdyeah.top/ \nGithub: https://github.com/mxdabc/epg`;
4327
console.info(`%c${title1} %c${title2} %c${content}`, styleTitle1, styleTitle2, styleContent);
44-
}
28+
}

utils/general.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
"include_xml": [], ##生成数据时,不会分类阻止也会提供频道信息 单频道
4444
}
4545
xmlinfo = {
46-
"all": {"basename": "all-mxdyeah.xml", "sortname": "all"},
47-
"yangwei": {"basename": "cc-mxdyeah.xml", "sortname": ["央视", "卫视"]},
46+
"all": {"basename": "all.xml", "sortname": "all"},
47+
"yangwei": {"basename": "cc.xml", "sortname": ["央视", "卫视"]},
4848
"difang": {
49-
"basename": "difang-mxdyeah.xml",
49+
"basename": "difang.xml",
5050
"sortname": ["数字付费", "辽宁", "山东", "湖北", "四川"],
5151
},
52-
"oversea": {"basename": "gat-mxdyeah.xml", "sortname": ["香港", "台湾", "海外"]},
52+
"oversea": {"basename": "gat.xml", "sortname": ["香港", "台湾", "海外"]},
5353
}
5454

5555

uwsgi/epg.service

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[Unit]
2+
Description=uWSGI service for mxdEPG APP
3+
After=network.target
4+
5+
[Service]
6+
ExecStart=/mxdyeah/epg/pyenv/bin/uwsgi --ini /mxdyeah/epg/uwsgi/uwsgi.ini --master --need-app
7+
WorkingDirectory=/mxdyeah/epg
8+
Environment="PATH=/mxdyeah/epg/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
9+
Restart=always
10+
RestartSec=5
11+
KillSignal=SIGTERM
12+
Type=forking
13+
ExecStop=/usr/bin/kill -SIGTERM $(cat /mxdyeah/epg/uwsgi/uwsgi.pid)
14+
PIDFile=/mxdyeah/epg/uwsgi/uwsgi.pid
15+
16+
[Install]
17+
WantedBy=multi-user.target

uwsgi/uwsgi.ini

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,68 @@
1-
# 全部写绝对路径!
2-
# 你需要逐字逐句修改这里的路径
31
[uwsgi]
4-
# the local unix socket file than commnuincate to Nginx 用于和 nginx 进行数据交互的端口
5-
socket = 127.0.0.1:22200
2+
# the local unix socket file than communicate to Nginx 用于和 nginx 进行数据交互的端口
3+
socket = 127.0.0.1:8081
4+
65
# the base directory (full path) django 程序的主目录
76
chdir = /mxdyeah/epg
7+
88
# Django's wsgi file
99
wsgi-file = /mxdyeah/epg/epg/wsgi.py
10+
1011
# maximum number of worker processes
12+
# 根据4核心CPU,建议设置为 4 个进程,每个进程单独使用一个核心
1113
processes = 4
12-
# thread numbers startched in each worker process
13-
threads = 8
14+
15+
# thread numbers started in each worker process
16+
# 每个进程建议设置 2~4 个线程,充分利用多线程处理请求
17+
threads = 2
18+
19+
# 启用主进程来管理其他进程,其它的uwsgi进程都是这个master进程的子进程
20+
master = true
21+
1422
# clear environment on exit
1523
vacuum = true
24+
1625
# 后台运行,并输出日志
1726
daemonize = /mxdyeah/epg/uwsgi/uwsgi.log
27+
1828
# pid 文件地址
19-
pidfile=/mxdyeah/epg/uwsgi/uwsgi.pid
20-
# 启用主进程来管理其他进程,其它的uwsgi进程都是这个master进程的子进程,如果kill这个master进程,相当于重启所有的uwsgi进程。
21-
master=true
22-
# 启用线程 允许用内嵌的语言启动线程。这将允许你在app程序中产生一个子线程
23-
enable-threads=true
24-
# 当服务停止的时候自动移除unix Socket和pid文件
25-
vacuum=true
26-
# 不记录信息日志,只记录错误以及uwsgi内部消息
27-
disable-logging=true
29+
pidfile = /mxdyeah/epg/uwsgi/uwsgi.pid
30+
31+
# 启用线程,允许用内嵌的语言启动线程
32+
enable-threads = true
33+
34+
# 当服务停止的时候自动移除 unix Socket 和 pid 文件
35+
vacuum = true
36+
37+
# 不记录信息日志,只记录错误以及 uwsgi 内部消息
38+
disable-logging = true
39+
2840
# 设置最大日志文件大小
29-
log-maxsize = 5000000
30-
# 为每个工作进程设置请求数的上限。当一个工作进程处理的请求数达到这个值,那么该工作进程就会被回收重用(重启)。你可以使用这个选项来默默地对抗内存泄漏
31-
# 默认50W是上限
32-
max-requests = 500000
33-
# 一个请求花费的时间超过了这个harakiri超时时间,那么这个请求都会被丢弃,并且当前处理这个请求的工作进程会被回收再利用(即重启)
34-
harakiri = 60
41+
log-maxsize = 5242880
42+
43+
# 为每个工作进程设置请求数的上限。当一个工作进程处理的请求数达到这个值,那么该工作进程就会被回收重用(重启)
44+
# 根据内存限制,建议每个进程处理 10,000 个请求后重启
45+
max-requests = 10000
46+
47+
# 一个请求花费的时间超过了这个 harakiri 超时时间,那么这个请求都会被丢弃,并且当前处理这个请求的工作进程会被回收再利用(即重启)
48+
# 根据应用场景调整为 120 秒,适合多数场景
49+
harakiri = 120
50+
51+
# 超出 1GB 时重启工作进程
52+
reload-on-as = 1073741824
53+
54+
# 设置缓冲区大小,避免处理大请求时失败
55+
buffer-size = 65535
56+
57+
# 防止僵尸进程
58+
no-orphans = true
59+
60+
# 优化服务性能,减少内存碎片
61+
thunder-lock = true
62+
lazy-apps = true
63+
64+
# 优化线程处理,防止队列过载
65+
cheap = true
66+
67+
# 设置 uwsgi 的信号量
68+
disable-logging = true

web/templates/epg.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h1>mxd's EPG</h1>
3232
<div class="fontsize22px">
3333
DIYP接口<code>https://[ip或域名]/api/diyp/</code><br>使用DIYP需要提供参数,例如:<code>?ch=CCTV1&amp;date=20230701</code>
3434
<br />
35-
XML下载地址<code>https://[ip或域名]/download/all-mxdyeah.xml</code>
35+
XML下载地址<code>https://[ip或域名]/download/all.xml</code>
3636
</div>
3737
</div>
3838
<p style="text-wrap: wrap;">

web/templates/web_epg.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ <h2 class="title">当前节目及日期:{{ title }}</h2>
155155
</div>
156156
<footer class="epg-footer">
157157
<div class="epg_footer">
158-
<a href="https://epg.imxd.top/">mxd's&nbsp;EPG</a>&nbsp;is&nbsp;Powered&nbsp;by
159-
<a href="https://mxdyeah.top/">mxd.</a><br>
158+
<a href="https://epg.crestekk.cn/">mxd's&nbsp;EPG</a>&nbsp;is&nbsp;Powered&nbsp;by
159+
<a href="https://www.mxdyeah.top/">mxd.</a><br>
160160
<a href="https://github.com/mxdabc/epg/">开源Github,请给我们一个Star!</a>
161161
</div>
162162
</footer>

0 commit comments

Comments
 (0)