fail if init call fails

This commit is contained in:
j 2012-03-06 21:32:52 +01:00
parent 23bbdab7a1
commit 9da522a885

View file

@ -161,7 +161,7 @@ class Client(object):
def online(self): def online(self):
self.api = API(self._config['url'], media_cache=self.media_cache()) self.api = API(self._config['url'], media_cache=self.media_cache())
self.api.DEBUG = DEBUG self.api.DEBUG = DEBUG
self.signin() if self.signin():
self.profile = "%sp.webm" % max(self.api.site['video']['resolutions']) self.profile = "%sp.webm" % max(self.api.site['video']['resolutions'])
def signin(self): def signin(self):
@ -172,10 +172,13 @@ class Client(object):
else: else:
self.user = False self.user = False
print '\nlogin failed! check config\n\n' print '\nlogin failed! check config\n\n'
sys.exit() sys.exit(1)
r = self.api.init() r = self.api.init()
if r['status']['code'] == 200: if r['status']['code'] == 200:
self.api.site = r['data']['site'] self.api.site = r['data']['site']
else:
print "\n init failed.", r['status']
sys.exit(1)
return True return True
def set_encodes(self, site, files): def set_encodes(self, site, files):