diff --git a/app.py b/app.py index c9788d8ed58b220461686744b2513dcbfe7fb355..394d3d96e2a97954477f5cf7882e459125c531a6 100644 --- a/app.py +++ b/app.py @@ -58,7 +58,11 @@ else: # from geventwebsocket.handler import WebSocketHandler RuleClass = rule_classes.init(db) PlayParse = play_parse.init(db) - +lsg = storage.init(db) +print(lsg.setItem('直播地址','https://gitcode.net/qq_26898231/TVBox/-/raw/main/live/zb.txt')) +t12 = time() +print(lsg.getItem('直播地址','111')) +print(get_interval(t12)) def is_linux(): return not 'win' in sys.platform diff --git a/config.py b/config.py index e89538b8cc9a30f56185b84c33bdc3fdbadbeb80..3a2ba8c04afc6f939c80cadf21a0c86f34294a88 100644 --- a/config.py +++ b/config.py @@ -33,6 +33,6 @@ UNAME = 'admin' # 管理员账号 PWD = 'drpy' # 管理员密码 MAX_CONTENT_LENGTH = 1 * 1024 * 1024/100 # 100 kB LIVE_MODE = 1 # 0 本地 1外网 -LIVE_URL = 'https://gitcode.net/qq_26898231/TVBox/-/raw/main/live/0830zb.txt' # 外网直播地址 +LIVE_URL = 'https://gitcode.net/qq_26898231/TVBox/-/raw/main/live/zb.txt' # 外网直播地址 CATE_EXCLUDE = '首页|留言|APP|下载|资讯|新闻|动态' # 动态分类过滤 # {% if config.WALL_PAPER %}"wallpaper":"{{ config.WALL_PAPER }}",{% endif %} \ No newline at end of file diff --git a/js/alist.txt b/js/alist.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba3b0260d5de0dec3b78348359a3ea20d38ea3ff --- /dev/null +++ b/js/alist.txt @@ -0,0 +1,27 @@ +{ + "🔮嗨翻":"https://pan.hikerfans.com", + "🦀9T(Adult)":"https://drive.9t.ee", + "🐱梓澪の妙妙屋":"https://xn--i0v44m.xyz", + "🚆资源小站":"https://pan.142856.xyz", + "🌤晴园的宝藏库":"https://alist.52qy.repl.co", + "🐭米奇妙妙屋":"https://anime.mqmmw.ga", + "💂小兵组网盘影视":"https://6vv.app", + "📀小光盘":"https://alist.xiaoguanxiaocheng.life", + "🐋一只鱼":"https://alist.youte.ml", + "🌊七米蓝":"https://al.chirmyram.com", + "🌴非盘":"http://www.feifwp.top", + "🥼帅盘":"https://hi.shuaipeng.wang", + "🐉神族九帝":"https://alist.shenzjd.com", + "☃姬路白雪":"https://pan.jlbx.xyz", + "🎧听闻网盘":"https://wangpan.sangxuesheng.com", + "💾DISK":"http://124.222.140.243:8080", + "🌨云播放":"https://quanzi.laoxianghuijia.cn", + "✨星梦":"https://pan.bashroot.top", + "🌊小江":"https://dyj.me", + "💫触光":"https://pan.ichuguang.com", + "🕵好汉吧":"https://8023.haohanba.cn", + "🥗AUNEY":"http://121.227.25.116:8008", + "🎡资源小站":"https://960303.xyz/", + "🏝fenwe":"http://www.fenwe.tk:5244", + "🎢轻弹浅唱":"https://g.xiang.lol" +} diff --git a/models/__init__.py b/models/__init__.py index ad5d31fde6828a70364d055c0000c7c8a63e4e3b..574f494b771176b01eb4c4e6c1a06a8fe8becc13 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -5,4 +5,5 @@ # Date : 2022/8/25 from . import rule_classes -from . import play_parse \ No newline at end of file +from . import play_parse +from . import storage \ No newline at end of file diff --git a/models/rules.db b/models/rules.db index 1be8eebe34935d66835455ee779a3cf36c023ef3..f728daa37e87aaf7ccb695afdbe2da31bdc05510 100644 Binary files a/models/rules.db and b/models/rules.db differ diff --git a/models/storage.py b/models/storage.py new file mode 100644 index 0000000000000000000000000000000000000000..1e133d6af88296b429ec6323e96be101be3a63cf --- /dev/null +++ b/models/storage.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# File : storage.py +# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------ +# Date : 2022/9/6 + +from functools import lru_cache + +def init(db): + class Storage(db.Model): + __tablename__ = 'storage' + id = db.Column(db.Integer, primary_key=True, autoincrement=True) + key = db.Column(db.String(20),unique=True) + value = db.Column(db.UnicodeText()) + # value = db.Column(db.Text()) + + def __repr__(self): + return "" % ( + self.key, self.value) + + @classmethod + def setItem(self, key, value=None): + res = db.session.query(self).filter(self.key == key).first() + if res: + res.value = value + db.session.add(res) + else: + res = Storage(key=key, value=value) + db.session.add(res) + db.session.flush() + try: + db.session.commit() + self.clearCache() + return res.id + except Exception as e: + print(f'发生了错误:{e}') + return None + + @classmethod + @lru_cache(maxsize=200) + def getItem(self, key, value=''): + res = db.session.query(self).filter(self.key == key).first() + if res: + return res.value or value + else: + return value + + @classmethod + def clearItem(self, key): + self.clearCache() + res = db.session.query(self).filter(self.key == key).first() + if res: + res.delete() + ret = db.session.commit() + self.clearCache() + return ret + else: + return True + + @classmethod + def clearCache(self): + self.getItem.cache_clear() + + # db.create_all() + db.create_all() + return Storage \ No newline at end of file diff --git a/static/css/admin.css b/static/css/admin.css index e79d48ba0545cc2e2e391159db27878ad31971cf..81d62d8f930c120f1d98bf65c7372680e6cafe69 100644 --- a/static/css/admin.css +++ b/static/css/admin.css @@ -2,4 +2,68 @@ /*font-size: 18px;*/ color: #5dc2f1; -} \ No newline at end of file +} + +.red { + color:red; + font-weight: bold; + padding-left:10px; + /*padding-top:10px;*/ + margin-left:10px; + width: 360px; + height: 30px; + } + .green { + color:forestgreen; + font-weight: bold; + padding-left:10px; + /*padding-top:10px;*/ + margin-left:10px; + width: 360px; + height: 30px; + } + .btn{ + color:#FFFFFF; + background-color: #1379cb; + } + .clear{ + /*word-spacing:2px;*/ + letter-spacing:5px; + margin-left:20px; + width: 120px; + height: 30px; + text-align: center; + border-style: solid; + /*border-color: #8CD4F5;*/ + border-color: #1379cb; + text-decoration:none; + color:#FFFFFF; + background-color: #1379cb; + } + .view_home{ + letter-spacing:5px; + margin-left:20px; + width: 150px; + height: 30px; + text-align: center; + border-style: solid; + /*border-color: #8CD4F5;*/ + border-color: #17af30; + text-decoration:none; + color:#FFFFFF; + background-color: #17af30; + } + /*li a {*/ + /* display: block !important;*/ + /*}*/ + .ver_title{ + font-size: 15px;margin-left: 20px + } + + .ver{ + font-size: 16px;margin-left: 5px;color: #ea7d7d; + } + + a.funcbtn{ + margin-left: 10px; + } \ No newline at end of file diff --git a/static/js/common.js b/static/js/common.js new file mode 100644 index 0000000000000000000000000000000000000000..e2c7546adecf2811f1b6aa0d1e547c87a0a9b667 --- /dev/null +++ b/static/js/common.js @@ -0,0 +1,18 @@ +function copy(text,mode){ + mode = mode||0; + if(mode === 0){ + let el = $(''); +    $('body').prepend(el); //添加到元素内部的前面 + el.val(text); // 修改文本框的内容 + el.select(); //选中 + console.log('复制的内容:\n'+text); + document.execCommand("copy"); // 执行浏览器复制命令 + el.remove(); + }else{ + let el = $(text); + console.log('复制的内容:\n'+el.val()); + el.select(); //选中 + document.execCommand("copy"); // 执行浏览器复制命令 + } + alert("复制成功"); +} \ No newline at end of file diff --git a/templates/admin.html b/templates/admin.html index 0b8f5ad62fc7fff28fb63d6d8e0cc8ad637adebc..7d2522b7693a870440c7c6c78bd2eed190f5542f 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -9,86 +9,17 @@ + - -

欢迎使用drpy管理员界面当前版本:{{ ver }}

+

欢迎使用drpy管理员界面

+

+ 当前版本:{{ ver }} +

返回首页 检测升级 -cp ./tmp/dr_py-master/app.py ./app.py + +复制主程升级指令 +同步直播源

你可以在此页面在线上传规则文件到js目录或者删除js目录的文件

-