Permalink
Browse files

set_uid

  • Loading branch information...
1 parent a957d82 commit 9a1e4a4172942f2f44f70d76bf7e3bbee989ff83 binux committed Mar 16, 2012
Showing with 32 additions and 2 deletions.
  1. +12 −0 handlers/manager.py
  2. +8 −1 libs/db_task_manager.py
  3. +12 −1 templates/manager.html
View
@@ -40,6 +40,18 @@ def recheck_login(self):
_ = self.task_manager.xunlei
return ""
+ def set_uid(self):
+ uid = self.get_argument("uid")
+ gdriveid = self.get_argument("gdriveid")
+ tid = int(self.get_argument("tid"))
+ self.task_manager._uid = uid
+ self.task_manager._gdriveid = gdriveid
+ self.task_manager.last_task_id = tid
+ return "uid=%s, gdriveid=%s, tid=%s" % (
+ self.task_manager.uid,
+ self.task_manager.gdriveid,
+ self.task_manager.last_task_id)
+
def set_tid(self):
tid = int(self.get_argument("tid"))
self.task_manager.last_task_id = tid
@@ -50,11 +50,14 @@ def __init__(self, username, password):
self.time = time
self._xunlei = LiXianAPI()
- self.last_task_id = 0
self.task_id_sample = set()
self.islogin = self._xunlei.login(self.username, self.password)
self._last_check_login = time()
+ self._uid = None
+ self._gdriveid = None
+ self.last_task_id = 0
+
@property
def xunlei(self):
if self._last_check_login + options.check_interval < time():
@@ -66,10 +69,14 @@ def xunlei(self):
@property
def gdriveid(self):
+ if self._gdriveid:
+ return self._gdriveid
return self._xunlei.gdriveid
@property
def uid(self):
+ if self._uid:
+ return self._uid
return self._xunlei.uid
@sqlalchemy_rollback
@@ -16,9 +16,12 @@
<section id="status">
<dl>
<dt>当前迅雷用户</dt>
- <dd>{{ handler.task_manager.username }} - {{ handler.task_manager.uid }} -
+ <dd>{{ handler.task_manager.username }} - {{ handler.task_manager._xunlei.uid }} -
<a href="/manager/recheck_login">{{ "已登录" if handler.task_manager.islogin else "未登录" }}</a></dd>
+ <dt>当前uid</dt>
+ <dd>{{ handler.task_manager.uid }}</dt>
+
<dt>当前task_id</dt>
<dd>{{ handler.task_manager.last_task_id }}</dt>
@@ -51,6 +54,14 @@
</ul>
</dd>
</li>
+ <li>
+ <form action="/manager/set_uid" method="GET">设置uid,gdriveid,tid: <br />
+ uid: <input name="uid" type="text" value="{{ handler.task_manager.uid }}" /> <br />
+ gdriveid: <input name="gdriveid" type="text" value="{{ handler.task_manager.gdriveid }}" /> <br />
+ tid: <input name="tid" type="text" value="{{ handler.task_manager.last_task_id }}" /> <br />
+ <input type="submit" value="submit" />
+ </form>
+ </li>
</ul>
</section>
{% end %}

0 comments on commit 9a1e4a4

Please sign in to comment.