xchat xdcc down

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# -*- coding: utf-8 -*-
import xchat
import time
from collections import deque
#DCC status (queued=0, active=1, failed=2, done=3, connecting=4 aborted=5).
def check_dcc_list_free():
s = xchat.get_list('dcc')
[return False for i in s if i.status in set((0, 1))]
return True
def start_one(nick, num):
#print 'msg %s xdcc send #%s' % (nick, num)
xchat.command('msg %s xdcc send #%s' % (nick, num))
myhook = None
dq = deque()
def start_batch(tasks = None):
# tasks : [(nick, num),]
if tasks is not None:
dq.extend(tasks)
def starter(userdata):
if check_dcc_list_free(): # \u043c\u043e\u0436\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0434\u0430\u0432\u0430\u0442\u044c
try:
nick, num = dq.popleft()
start_one(nick, num)
except:
print 'tasks ended' # \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0447\u0438\u043b\u0438\u0441\u044c, \u043e\u0441\u0442\u0430\u043d\u043e\u0432
return
return 1 # \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0446\u0438\u043a\u043b
myhook = xchat.hook_timer(1000, starter)
def start_batch_one_author(nick, nums):
tasks = [(nick, num)for num in nums]
start_batch(tasks)
def add_tasks(tasks):
dq.extend(tasks)
def add_tasks_one_author(nick, nums):
tasks = [(nick, num)for num in nums]
add_tasks(tasks)
newtasks = [1810,1829,]