ignore files with errors but still sync
This commit is contained in:
parent
f70b934b8d
commit
c9edb4bd79
3 changed files with 39 additions and 33 deletions
|
@ -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,13 +493,14 @@ class Client(object):
|
||||||
self.update_encodes()
|
self.update_encodes()
|
||||||
|
|
||||||
for oshash in files:
|
for oshash in files:
|
||||||
for path in self.path(oshash):
|
info = self.info(oshash)
|
||||||
if os.path.exists(path):
|
if not 'error' in info:
|
||||||
info = self.info(oshash)
|
for path in self.path(oshash):
|
||||||
#print path.encode('utf-8')
|
if os.path.exists(path):
|
||||||
i = encode(path, self.media_cache(), self.profile, info,
|
#print path.encode('utf-8')
|
||||||
self.api.site['media'].get('importFrames'))
|
i = encode(path, self.media_cache(), self.profile, info,
|
||||||
break
|
self.api.site['media'].get('importFrames'))
|
||||||
|
break
|
||||||
|
|
||||||
def sync(self, args):
|
def sync(self, args):
|
||||||
if not self.user:
|
if not self.user:
|
||||||
|
@ -624,28 +627,29 @@ 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 = {}
|
||||||
for path in self.path(oshash):
|
info = self.info(oshash)
|
||||||
if os.path.exists(path):
|
if not 'error' in info:
|
||||||
info = self.info(oshash)
|
for path in self.path(oshash):
|
||||||
if not self.api.uploadVideo(path,
|
if os.path.exists(path):
|
||||||
data, self.profile, info):
|
if not self.api.uploadVideo(path,
|
||||||
print 'video upload failed, giving up, please try again'
|
data, self.profile, info):
|
||||||
return
|
print 'video upload failed, giving up, please try again'
|
||||||
if 'rightsLevel' in self._config:
|
return
|
||||||
r = self.api.find({'query': {
|
if 'rightsLevel' in self._config:
|
||||||
'conditions': [
|
r = self.api.find({'query': {
|
||||||
{'key': 'oshash', 'value': oshash, 'operator': '=='}
|
'conditions': [
|
||||||
],
|
{'key': 'oshash', 'value': oshash, 'operator': '=='}
|
||||||
'keys': ['id'],
|
],
|
||||||
'range': [0, 1]
|
'keys': ['id'],
|
||||||
}})
|
'range': [0, 1]
|
||||||
if r['data']['items']:
|
}})
|
||||||
item = r['data']['items'][0]['id']
|
if r['data']['items']:
|
||||||
r = self.api.edit({
|
item = r['data']['items'][0]['id']
|
||||||
'item': item,
|
r = self.api.edit({
|
||||||
'rightsLevel': self._config['rightsLevel']
|
'item': item,
|
||||||
})
|
'rightsLevel': self._config['rightsLevel']
|
||||||
break
|
})
|
||||||
|
break
|
||||||
|
|
||||||
if files:
|
if files:
|
||||||
print 'uploading %s files' % len(files)
|
print 'uploading %s files' % len(files)
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue