mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
@@ -14,3 +14,9 @@ QB_PWD = adminadmin
|
|||||||
|
|
||||||
[file]
|
[file]
|
||||||
FILE_TO=/www/tmp
|
FILE_TO=/www/tmp
|
||||||
|
FILE_OWN=www
|
||||||
|
FILE_GROUP=www
|
||||||
|
|
||||||
|
[task]
|
||||||
|
TASK_RATE=4
|
||||||
|
TASK_COMPLETED_RATE=10
|
||||||
@@ -151,16 +151,20 @@ class downloadBT(Thread):
|
|||||||
def checkTask(self):
|
def checkTask(self):
|
||||||
while True:
|
while True:
|
||||||
torrents = self.qb.torrents()
|
torrents = self.qb.torrents()
|
||||||
for torrent in torrents:
|
tlen = len(torrents)
|
||||||
print torrent
|
print "downloading torrents count:", tlen
|
||||||
print time.time(), "no task!"
|
if tlen > 0:
|
||||||
|
for torrent in torrents:
|
||||||
|
print torrent
|
||||||
|
else:
|
||||||
|
print time.time(), "no task!"
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
def completed(self):
|
def completed(self):
|
||||||
while True:
|
while True:
|
||||||
torrents = self.qb.torrents(filter='completed')
|
torrents = self.qb.torrents(filter='completed')
|
||||||
tlen = len(torrents)
|
tlen = len(torrents)
|
||||||
print "torrents count:", tlen
|
print "completed torrents count:", tlen
|
||||||
if tlen > 0:
|
if tlen > 0:
|
||||||
for torrent in torrents:
|
for torrent in torrents:
|
||||||
path = torrent['save_path'] + torrent['name']
|
path = torrent['save_path'] + torrent['name']
|
||||||
@@ -183,8 +187,8 @@ if __name__ == "__main__":
|
|||||||
dl = downloadBT()
|
dl = downloadBT()
|
||||||
|
|
||||||
import threading
|
import threading
|
||||||
# t = threading.Thread(target=dl.checkTask)
|
task = threading.Thread(target=dl.checkTask)
|
||||||
# t.start()
|
task.start()
|
||||||
|
|
||||||
completed = threading.Thread(target=dl.completed)
|
completed = threading.Thread(target=dl.completed)
|
||||||
completed.start()
|
completed.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user