dont fail if not extracting videos, get real folderdepth, dont relogin just give up
This commit is contained in:
parent
bec480c7cf
commit
0d011e428c
1 changed files with 21 additions and 16 deletions
|
@ -36,7 +36,8 @@ def encode(filename, prefix, profile, info=None, extract_frames=True):
|
||||||
oshash = info['oshash']
|
oshash = info['oshash']
|
||||||
frames = []
|
frames = []
|
||||||
cache = os.path.join(prefix, os.path.join(*utils.hash_prefix(oshash)))
|
cache = os.path.join(prefix, os.path.join(*utils.hash_prefix(oshash)))
|
||||||
if info['video'] and extract_frames:
|
if info.get('video'):
|
||||||
|
if extract_frames:
|
||||||
for pos in utils.video_frame_positions(info['duration']):
|
for pos in utils.video_frame_positions(info['duration']):
|
||||||
frame_name = '%s.png' % pos
|
frame_name = '%s.png' % pos
|
||||||
frame_f = os.path.join(cache, frame_name)
|
frame_f = os.path.join(cache, frame_name)
|
||||||
|
@ -47,6 +48,10 @@ def encode(filename, prefix, profile, info=None, extract_frames=True):
|
||||||
video_f = os.path.join(cache, profile)
|
video_f = os.path.join(cache, profile)
|
||||||
if not os.path.exists(video_f):
|
if not os.path.exists(video_f):
|
||||||
extract.video(filename, video_f, profile, info)
|
extract.video(filename, video_f, profile, info)
|
||||||
|
else:
|
||||||
|
print info
|
||||||
|
print filename
|
||||||
|
return None
|
||||||
return {
|
return {
|
||||||
'info': info,
|
'info': info,
|
||||||
'oshash': oshash,
|
'oshash': oshash,
|
||||||
|
@ -181,7 +186,7 @@ class Client(object):
|
||||||
self.api.DEBUG = DEBUG
|
self.api.DEBUG = DEBUG
|
||||||
if 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'])
|
||||||
self.folderdepth = self.api.site.get('folderdepth', 3)
|
self.folderdepth = self.api.site['site'].get('folderdepth', 3)
|
||||||
|
|
||||||
def signin(self):
|
def signin(self):
|
||||||
if 'username' in self._config:
|
if 'username' in self._config:
|
||||||
|
@ -345,7 +350,8 @@ class Client(object):
|
||||||
and not filename in ('.DS_Store', ) \
|
and not filename in ('.DS_Store', ) \
|
||||||
and not filename.endswith('~'):
|
and not filename.endswith('~'):
|
||||||
file_path = os.path.join(dirpath, filename)
|
file_path = os.path.join(dirpath, filename)
|
||||||
if os.path.exists(file_path) and os.stat(file_path).st_size>0:
|
if not 'Extras/' in file_path \
|
||||||
|
and os.path.exists(file_path) and os.stat(file_path).st_size>0:
|
||||||
files.append(file_path)
|
files.append(file_path)
|
||||||
self.scan_file(file_path)
|
self.scan_file(file_path)
|
||||||
|
|
||||||
|
@ -536,8 +542,7 @@ class Client(object):
|
||||||
info = self.info(oshash)
|
info = self.info(oshash)
|
||||||
if not self.api.uploadVideo(path,
|
if not self.api.uploadVideo(path,
|
||||||
data, self.profile, info):
|
data, self.profile, info):
|
||||||
if not self.signin():
|
print 'video upload failed, giving up, please try again'
|
||||||
print "failed to login again"
|
|
||||||
return
|
return
|
||||||
if 'rightsLevel' in self._config:
|
if 'rightsLevel' in self._config:
|
||||||
r = self.api.find({'query': {
|
r = self.api.find({'query': {
|
||||||
|
|
Loading…
Reference in a new issue