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

View file

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

View file

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