ignore files with errors but still sync

This commit is contained in:
j 2013-04-30 18:09:15 +02:00
parent f70b934b8d
commit c9edb4bd79
3 changed files with 39 additions and 33 deletions

View file

@ -312,7 +312,7 @@ class Client(object):
if update:
info = utils.avinfo(path)
if 'error' in info or info['size'] == 0:
print info
#print info
return False
else:
oshash = info['oshash']
@ -448,12 +448,14 @@ class Client(object):
print '\n\t'.join([f[len(path):] for f in unknown])
print ''
'''
if unsupported:
files = list(set(files) - set(unsupported))
print 'The following files are in an unsupported format and will not be synced:'
print '\t',
print '\n\t'.join([f[len(path):] for f in unsupported])
print ''
'''
deleted_files = filter(lambda f: f not in files, known_files)
new_files = filter(lambda f: f not in known_files, files)
@ -491,9 +493,10 @@ class Client(object):
self.update_encodes()
for oshash in files:
info = self.info(oshash)
if not 'error' in info:
for path in self.path(oshash):
if os.path.exists(path):
info = self.info(oshash)
#print path.encode('utf-8')
i = encode(path, self.media_cache(), self.profile, info,
self.api.site['media'].get('importFrames'))
@ -624,9 +627,10 @@ class Client(object):
print 'encoding and uploading %s videos' % len(data)
for oshash in data:
data = {}
info = self.info(oshash)
if not 'error' in info:
for path in self.path(oshash):
if os.path.exists(path):
info = self.info(oshash)
if not self.api.uploadVideo(path,
data, self.profile, info):
print 'video upload failed, giving up, please try again'

View file

@ -156,7 +156,7 @@ def video_cmd(video, target, profile, info):
audiobitrate = '22k'
audiochannels = 1
if 'video' in info and info['video'] and 'display_aspect_ratio' in info['video'][0]:
if info['video'] and 'display_aspect_ratio' in info['video'][0]:
dar = AspectRatio(info['video'][0]['display_aspect_ratio'])
fps = AspectRatio(info['video'][0]['framerate'])
width = int(dar * height)
@ -232,7 +232,7 @@ def video_cmd(video, target, profile, info):
else:
video_settings = ['-vn']
if 'audio' in info and info['audio']:
if info['audio']:
if video_settings == ['-vn'] or not info['video']:
n = 0
else:

View file

@ -124,10 +124,12 @@ class Server(Resource):
self.update_status(oshash, 'done')
self.upload.put(oshash)
continue
info = self.client.info(oshash)
if 'error' in info:
continue
for f in self.client.path(oshash):
if os.path.exists(f):
response['oshash'] = oshash
info = self.client.info(oshash)
url = 'http://%s:%s/get/%s' % (request.host.host, request.host.port, oshash)
output = '/tmp/%s.%s' % (oshash, self.client.profile)
response['cmd'] = extract.video_cmd(url, output, self.client.profile, info)