site config
This commit is contained in:
parent
857a30db35
commit
052625af16
2 changed files with 6 additions and 6 deletions
|
@ -22,7 +22,7 @@ if __name__ == '__main__':
|
||||||
(opts, args) = parser.parse_args()
|
(opts, args) = parser.parse_args()
|
||||||
|
|
||||||
opts.config = os.path.expanduser(opts.config)
|
opts.config = os.path.expanduser(opts.config)
|
||||||
if None in (opts.config, ) or (args[0] != 'config' and not os.path.exists(opts.config)):
|
if None in (opts.config, ) or (args and args[0] != 'config' and not os.path.exists(opts.config)):
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ class Client(object):
|
||||||
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()
|
self.signin()
|
||||||
self.profile = "%sp.webm" % max(self.api._config['video']['resolutions'])
|
self.profile = "%sp.webm" % max(self.site['video']['resolutions'])
|
||||||
|
|
||||||
def signin(self):
|
def signin(self):
|
||||||
if 'username' in self._config:
|
if 'username' in self._config:
|
||||||
|
@ -169,7 +169,7 @@ class Client(object):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
r = self.api.init()
|
r = self.api.init()
|
||||||
if r['status']['code'] == 200:
|
if r['status']['code'] == 200:
|
||||||
self.api._config = r['data']['site']
|
self.site = r['data']['site']
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_encodes(self, site, files):
|
def set_encodes(self, site, files):
|
||||||
|
@ -336,7 +336,7 @@ class Client(object):
|
||||||
info = self.info(oshash)
|
info = self.info(oshash)
|
||||||
#print path.encode('utf-8')
|
#print path.encode('utf-8')
|
||||||
i = encode(path, self.media_cache(), self.profile, info,
|
i = encode(path, self.media_cache(), self.profile, info,
|
||||||
self._config['media'].get('importFrames'))
|
self.site['media'].get('importFrames'))
|
||||||
break
|
break
|
||||||
|
|
||||||
def sync(self, args):
|
def sync(self, args):
|
||||||
|
@ -517,13 +517,13 @@ class API(ox.API):
|
||||||
|
|
||||||
def uploadVideo(self, filename, data, profile, info=None):
|
def uploadVideo(self, filename, data, profile, info=None):
|
||||||
i = encode(filename, self.media_cache, profile, info,
|
i = encode(filename, self.media_cache, profile, info,
|
||||||
self._config['media'].get('importFrames'))
|
self.site['media'].get('importFrames'))
|
||||||
if not i:
|
if not i:
|
||||||
print "failed"
|
print "failed"
|
||||||
return
|
return
|
||||||
|
|
||||||
#upload frames
|
#upload frames
|
||||||
if self._config['media'].get('importFrames'):
|
if self.site['media'].get('importFrames'):
|
||||||
form = ox.MultiPartForm()
|
form = ox.MultiPartForm()
|
||||||
form.add_field('action', 'upload')
|
form.add_field('action', 'upload')
|
||||||
form.add_field('id', i['oshash'])
|
form.add_field('id', i['oshash'])
|
||||||
|
|
Loading…
Reference in a new issue