Skip to content

Commit

Permalink
add condition for chaoji member #104
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion committed Aug 21, 2017
1 parent 33bce8e commit 486352c
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions swjsq.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,20 +372,25 @@ def run(self, uname, pwd, save = True):

yyyymmdd = time.strftime("%Y%m%d", time.localtime(time.time()))

_vas_debug = []
for _vas, _name, _v in ((VASID_DOWN, 'fastdick', 'do_down_accel'), (VASID_UP, 'upstream acceleration', 'do_up_accel')):
_dt = self.check_xunlei_vas(_vas)
_vas_debug.append({k:_dt[k] for k in _dt if k.startswith("other")})
if _dt['other_isVip'] == 1:
if _dt['other_expireDate'] < yyyymmdd:
print('Warning: Your %s membership expires on %s' % (_name, _dt['other_expireDate']))
else:
print('Expire date for %s: %s' % (_name, _dt['other_expireDate']))
setattr(self, _v, True)
if dt['isVip'] == 1 and dt['vasType'] == 5 and dt['expireDate'] > yyyymmdd: # choaji membership
self.do_down_accel = True
self.do_up_accel = True
print('Expire date for chaoji member: %s' % dt['expireDate'])
else:
_vas_debug = []
for _vas, _name, _v in ((VASID_DOWN, 'fastdick', 'do_down_accel'), (VASID_UP, 'upstream acceleration', 'do_up_accel')):
_dt = self.check_xunlei_vas(_vas)
_vas_debug.append({k:_dt[k] for k in _dt if k.startswith("other")})
if _dt['other_isVip'] == 1:
if _dt['other_expireDate'] < yyyymmdd:
print('Warning: Your %s membership expires on %s' % (_name, _dt['other_expireDate']))
else:
print('Expire date for %s: %s' % (_name, _dt['other_expireDate']))
setattr(self, _v, True)

if not self.do_down_accel and not self.do_up_accel:
print('Error: You are neither xunlei fastdick member nor upstream acceleration member, buy buy buy!\nDebug: %s' % _vas_debug)
os._exit(2)
if not self.do_down_accel and not self.do_up_accel:
print('Error: You are neither xunlei fastdick member nor upstream acceleration member, buy buy buy!\nDebug: %s' % _vas_debug)
os._exit(2)

if save:
try:
Expand Down

0 comments on commit 486352c

Please sign in to comment.