Skip to content

Commit

Permalink
增加至github
Browse files Browse the repository at this point in the history
  • Loading branch information
hjdhnx committed Apr 23, 2023
1 parent ee322ca commit 250833c
Show file tree
Hide file tree
Showing 706 changed files with 180,567 additions and 1,174 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/dr_py.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

829 changes: 160 additions & 669 deletions LICENSE

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : app.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date : 2022/9/6

from flask.app import Flask
from flask_migrate import Migrate
from base import config
from base.database import db
from utils.log import logger
from utils.system import get_wlan_info,getHost
from controllers import *
from js.rules import getRuleLists
import sys

def create_flask_app():
app = Flask(__name__, static_folder='static', static_url_path='/static')
app.config.from_object(config) # 单独的配置文件里写了,这里就不用弄json中文显示了
app.register_blueprint(home.home, url_prefix='')
app.register_blueprint(admin.admin, url_prefix='/admin')
app.register_blueprint(vod.vod, url_prefix='')
app.register_blueprint(cls.cls, url_prefix='/cls')
app.register_blueprint(layui.layui, url_prefix='/layui')
app.register_blueprint(parse.parse, url_prefix='/parse')
app.logger.name = "drLogger"
# lsg = service.storage_service()
logger.info(f"默认解析地址:{app.config.get('PLAY_URL')}")
# logger.info(f"自定义播放解析地址:{lsg.getItem('PLAY_URL')}")
logger.info(f'当前操作系统{sys.platform}')
rule_list = getRuleLists()
wlan_info,_ = get_wlan_info()
logger.info(rule_list)
logger.info(f'局域网: {getHost(1, app.config.get("HTTP_PORT"))}/index\n本地: {getHost(0, app.config.get("HTTP_PORT"))}/index\nwlan_info:{wlan_info}')
db.init_app(app)
db.app = app
db.create_all(app=app)
return app

app = create_flask_app()
migrate = Migrate(app, db)

now_python_ver = ".".join([str(i) for i in sys.version_info[:3]])
if sys.version_info < (3,9):
from gevent.pywsgi import WSGIServer
# from gevent import monkey
# monkey.patch_socket() # 开启socket异步
print(f'当前python版本{now_python_ver}为3.9.0及以下,支持gevent')
else:
print(f'当前python版本{now_python_ver}为3.9.0及以上,不支持gevent')

if __name__ == "__main__":
http_port = int(app.config.get('HTTP_PORT', 5705))
http_host = app.config.get('HTTP_HOST', '0.0.0.0')
if sys.version_info < (3, 9):
# server = WSGIServer(('0.0.0.0', 5705), app, handler_class=WebSocketHandler,log=app.logger)
# server = WSGIServer(('0.0.0.0', 5705), app, handler_class=WebSocketHandler,log=None)
server = WSGIServer((http_host, http_port), app, log=logger)
server.serve_forever()
else:
app.run(debug=False, host=http_host, port=http_port)
34 changes: 34 additions & 0 deletions app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
#kill -9 $(cat supervisord.pid) # 杀掉进程
msg='flask或0 ubuntu下自动识别gevent或普通启动flask\nsflask或1 ubuntu下gunicorn启动flask\ntermux或2 termux下自动识别gevent或普通启动flask\nstermux或3 termux下gunicorn启动flask\n'
case "$1" in
flask)
supervisord -c ./super/flask.conf
;;
0)
supervisord -c ./super/flask.conf
;;
sflask)
supervisord -c ./super/sflask.conf
;;
1)
supervisord -c ./super/sflask.conf
;;
termux)
supervisord -c ./super/termux.conf
;;
2)
supervisord -c ./super/termux.conf
;;
stermux)
supervisord -c ./super/stermux.conf
;;
3)
supervisord -c ./super/stermux.conf
;;
*)
echo -e $msg
;;
esac
# 保留一个 bash
/bin/bash
54 changes: 54 additions & 0 deletions base/R.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : R.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date : 2022/9/6

from flask import jsonify

class copy_utils:

@staticmethod
def obj_to_dic(obj):
'''
将传入的data对象转成字典
'''
result = {}
for temp in obj.__dict__:
if temp.startswith('_') or temp == 'metadata':
continue
result[temp] = getattr(obj, temp)
return result

@staticmethod
def obj_to_list(list_obj):
'''
将传入的data对象转成List,list中的元素是字典
'''
result = []
for obj in list_obj:
result.append(copy_utils.obj_to_dic(obj))
return result


class R(object):

@classmethod
def ok(self,msg='操作成功',data=None):
if not data:
data = []
result = {"code": 200, "msg": msg, "data": data,"count":len(data)}
return jsonify(result)

@classmethod
def error(self,msg="系统异常",code=404):
result = {"code": code, "msg": msg}
return jsonify(result)

@classmethod
def success(self,msg='操作成功', data=None):
return self.ok(msg,data)

@classmethod
def failed(self,msg="系统异常", code=404):
return self.error(msg,code)
9 changes: 9 additions & 0 deletions base/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : __init__.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date : 2022/9/6

from . import database
from . import config
from . import R
27 changes: 27 additions & 0 deletions base/alist.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# c=[];for(let i in a){c.push(i+','+a[i])}d=c.join('\n');console.log(d);
🙋丫仙女,http://alist.xiaoya.pro/
🦀9T(Adult),https://drive.9t.ee
🐱梓澪の妙妙屋,https://xn--i0v44m.xyz
🚆资源小站,https://pan.142856.xyz
🌤晴园的宝藏库,https://alist.52qy.repl.co
🐭米奇妙妙屋,https://anime.mqmmw.ga
🔮嗨翻,https://pan.hikerfans.com,5
💂小兵组网盘影视,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
57 changes: 57 additions & 0 deletions base/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : config.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date : 2022/9/6

DIALECT = 'mysql'
DRIVER = 'pymysql'
USERNAME = 'gp'
PASSWORD = '123456'
HOST = '127.0.0.1'
PORT = '3306'
DATABASE = 'pira'
# DB_URI = '{}+{}://{}:{}@{}:{}/{}?charset=utf8'.format(DIALECT, DRIVER, USERNAME, PASSWORD, HOST, PORT, DATABASE)
# DB_URI = 'sqlite:///models/rules.db?charset=utf8&check_same_thread=False'
DB_URI = 'sqlite:///base/rules.db?charset=utf8&check_same_thread=False'
SQLALCHEMY_DATABASE_URI = DB_URI
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ECHO = False # 打印sql语句
JSON_AS_ASCII = False # jsonify返回的中文正常显示
PLAY_URL = 'http://cms.nokia.press' # 匹配远程解析服务器链接 远程接口主页地址,后面不能有/
PLAY_URL = PLAY_URL.rstrip('/')
PID_URL = '' # 自定义的9001进程管理快捷方式
PID_URL = PID_URL.rstrip('/')
HTTP_HOST = '0.0.0.0'
HTTP_PORT = '5705'
PLAY_DISABLE = False # 全局禁用播放解析
LAZYPARSE_MODE = 1 # 播放解析模式(0 本地 1 局域网 2远程 仅在全局禁用为False的时候生效)
WALL_PAPER_ENABLE = True # 启用自定义壁纸
# WALL_PAPER = "https://picsum.photos/1280/720/?blur=10" # 自定义壁纸,可注释
WALL_PAPER = "https://tuapi.eees.cc/api.php?category=fengjing&type=302" # 自定义壁纸,可注释
SUP_PORT = 9001 # supervisord 服务端口
RETRY_CNT = 3 # 验证码重试次数
# OCR_API = 'http://192.168.3.224:9000/api/ocr_img' # 验证码识别接口,传参数data
# OCR_API = 'http://dm.mudery.com:10000' # 验证码识别接口,传参数data
OCR_API = 'https://api.nn.ci/ocr/b64/text' # 验证码识别接口,传参数data
UNAME = 'admin' # 管理员账号
PWD = 'drpy' # 管理员密码
USE_PY = 0 # 开启py源
JS0_DISABLE = 0 # 禁用js0
JS0_PASSWORD = '' # js0密码
JS_MODE = 0 # js模式 0 drpy服务器解析 1 pluto本地解析
MAX_CONTENT_LENGTH = 1 * 1024 * 100 # 100 kB
LIVE_MODE = 0 # 0 本地 1外网
# LIVE_URL = 'https://gitcode.net/bd/v/-/raw/main/live/zb.txt' # 初始化外网直播地址(后续在管理界面改)
# LIVE_URL = 'https://agit.ai/hu/hcr/raw/commit/f8e9c10309a533e5b06df133f859c45cb91f4731/0ER.txt' # 月光直播接口
LIVE_URL = 'https://raw.fastgit.org/zhanghong1983/TVBOXZY/main/TV/live.txt' # 初始化外网直播地址(后续在管理界面改)
CATE_EXCLUDE = '首页|留言|APP|下载|资讯|新闻|动态|明星|专题|最新|排行|解析' # 动态分类过滤
TAB_EXCLUDE = '猜你|喜欢|APP|下载|剧情|简介|排序' # 动态线路名过滤
# {% if config.WALL_PAPER %}"wallpaper":"{{ config.WALL_PAPER }}",{% endif %}
SEARCH_TIMEOUT = 5000 # 聚搜超时毫秒
SEARCH_LIMIT = 24 # 聚搜限制条数
MULTI_MODE = 0 # 多源模式
XR_MODE = 1 # 仙人模式
JS_PROXY = 'http://localhost:5705/admin/view/=>https://code.gitlink.org.cn/api/v1/repos/hjdhnx/dr_py/raw/master/js/' # 源代理
ALI_TOKEN = '' # 适用于初始配置的阿里云token
ENV = '{"bili_cookie":""}' # 自定义环境变量
Loading

0 comments on commit 250833c

Please sign in to comment.