mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
[db]
|
[db]
|
||||||
DB_HOST = 127.0.0.1
|
DB_HOST = 127.0.0.1
|
||||||
DB_USER = qbittorrent
|
|
||||||
DB_PORT = 3306
|
DB_PORT = 3306
|
||||||
|
DB_USER = qbittorrent
|
||||||
DB_PASS = qbittorrent
|
DB_PASS = qbittorrent
|
||||||
DB_NAME = qbittorrent
|
DB_NAME = qbittorrent
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<p onclick="pluginInitD('qbittorrent');">自启动</p>
|
<p onclick="pluginInitD('qbittorrent');">自启动</p>
|
||||||
<p onclick="pluginConfig('qbittorrent', '','get_sql');" title="手动导入SQL">导入SQL</p>
|
<p onclick="pluginConfig('qbittorrent', '','get_sql');" title="手动导入SQL">导入SQL</p>
|
||||||
<p onclick="pluginConfig('qbittorrent');">配置</p>
|
<p onclick="pluginConfig('qbittorrent');">配置</p>
|
||||||
|
<p onclick="pluginLogs('qbittorrent','','get_run_Log', 10);">日志</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="bt-w-con pd15">
|
<div class="bt-w-con pd15">
|
||||||
|
|||||||
@@ -15,12 +15,13 @@
|
|||||||
|
|
||||||
qb_start(){
|
qb_start(){
|
||||||
cd {$SERVER_PATH}/qbittorrent/workers
|
cd {$SERVER_PATH}/qbittorrent/workers
|
||||||
nohup python simdht_worker.py > {$SERVER_PATH}/qbittorrent/logs.pl 2>&1 &
|
nohup python dl_worker.py > {$SERVER_PATH}/qbittorrent/logs.pl 2>&1 &
|
||||||
}
|
}
|
||||||
|
|
||||||
qb_stop(){
|
qb_stop(){
|
||||||
echo "Stopping ..."
|
echo "Stopping ..."
|
||||||
ps -ef | grep qbittorrent-nox-bin | grep -v grep | awk '{print $2}' | xargs kill
|
#ps -ef | grep qbittorrent-nox-bin | grep -v grep | awk '{print $2}' | xargs kill
|
||||||
|
ps -ef | grep "python dl_worker.py" | grep -v grep | awk '{print $2}' | xargs kill
|
||||||
echo "Redis stopped"
|
echo "Redis stopped"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Executable
+12
@@ -0,0 +1,12 @@
|
|||||||
|
[db]
|
||||||
|
DB_HOST = 127.0.0.1
|
||||||
|
DB_PORT = 3306
|
||||||
|
DB_USER = qbittorrent
|
||||||
|
DB_PASS = qbittorrent
|
||||||
|
DB_NAME = qbittorrent
|
||||||
|
|
||||||
|
[qb]
|
||||||
|
QB_HOST = 127.0.0.1
|
||||||
|
QB_PORT = 8081
|
||||||
|
QB_USER = admin
|
||||||
|
QB_PWD = adminadmin
|
||||||
@@ -32,15 +32,53 @@ sys.path.append('/usr/local/lib/python2.7/site-packages')
|
|||||||
import MySQLdb as mdb
|
import MySQLdb as mdb
|
||||||
|
|
||||||
|
|
||||||
# from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
# cp = ConfigParser()
|
cp = ConfigParser()
|
||||||
# cp.read("../db.cfg")
|
cp.read("../qb.conf")
|
||||||
# section_db = cp.sections()[0]
|
section_db = cp.sections()[0]
|
||||||
# DB_HOST = cp.get(section_db, "DB_HOST")
|
DB_HOST = cp.get(section_db, "DB_HOST")
|
||||||
# DB_USER = cp.get(section_db, "DB_USER")
|
DB_USER = cp.get(section_db, "DB_USER")
|
||||||
# DB_PORT = cp.getint(section_db, "DB_PORT")
|
DB_PORT = cp.getint(section_db, "DB_PORT")
|
||||||
# DB_PASS = cp.get(section_db, "DB_PASS")
|
DB_PASS = cp.get(section_db, "DB_PASS")
|
||||||
# DB_NAME = cp.get(section_db, "DB_NAME")
|
DB_NAME = cp.get(section_db, "DB_NAME")
|
||||||
|
|
||||||
|
|
||||||
|
section_qb = cp.sections()[1]
|
||||||
|
QB_HOST = cp.get(section_qb, "QB_HOST")
|
||||||
|
QB_PORT = cp.get(section_qb, "QB_PORT")
|
||||||
|
QB_USER = cp.get(section_qb, "QB_USER")
|
||||||
|
QB_PWD = cp.get(section_qb, "QB_PWD")
|
||||||
|
|
||||||
|
|
||||||
|
class downloadBT(Thread):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
Thread.__init__(self)
|
||||||
|
self.setDaemon(True)
|
||||||
|
self.dbconn = mdb.connect(
|
||||||
|
DB_HOST, DB_USER, DB_PASS, DB_NAME, port=DB_PORT, charset='utf8')
|
||||||
|
self.dbconn.autocommit(False)
|
||||||
|
self.dbcurr = self.dbconn.cursor()
|
||||||
|
self.dbcurr.execute('SET NAMES utf8')
|
||||||
|
self.qb = self.qb()
|
||||||
|
|
||||||
|
def query(self, sql):
|
||||||
|
self.dbcurr.execute(sql)
|
||||||
|
result = self.dbcurr.fetchall()
|
||||||
|
data = map(list, result)
|
||||||
|
return data
|
||||||
|
|
||||||
|
def qb(self):
|
||||||
|
from qbittorrent import Client
|
||||||
|
url = 'http://' + QB_HOST + ':' + QB_PORT + '/'
|
||||||
|
qb = Client(url)
|
||||||
|
qb.login(QB_USER, QB_PWD)
|
||||||
|
return qb
|
||||||
|
|
||||||
|
def proccess(self):
|
||||||
|
while True:
|
||||||
|
print 123123
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def checkDL():
|
def checkDL():
|
||||||
@@ -51,9 +89,10 @@ def checkDL():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
# import threading
|
dl = downloadBT()
|
||||||
# t = threading.Thread(target=checkDL)
|
|
||||||
# t.setDaemon(True)
|
import threading
|
||||||
# t.start()
|
t = threading.Thread(target=dl.proccess)
|
||||||
|
t.start()
|
||||||
|
|
||||||
checkDL()
|
checkDL()
|
||||||
|
|||||||
Reference in New Issue
Block a user