update fcp2json
This commit is contained in:
parent
500de3286c
commit
03101d00dd
1 changed files with 19 additions and 20 deletions
35
fcp2json.py
35
fcp2json.py
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
|
||||||
import lxml
|
import lxml
|
||||||
|
@ -56,7 +56,7 @@ for g in tree.xpath('//clipitem'):
|
||||||
_end = _start + (_out - _in)
|
_end = _start + (_out - _in)
|
||||||
name = name.replace('.dv', '').replace('_ ', ': ')
|
name = name.replace('.dv', '').replace('_ ', ': ')
|
||||||
id = name.replace(' ', '%20')
|
id = name.replace(' ', '%20')
|
||||||
value = 'Source: <a href="/%s/%.3f,%.3f">%s/%s-%s</a>' % (id, _in, _out, name, ox.formatDuration(_in), ox.formatDuration(_out))
|
value = 'Source: <a href="/%s/%.3f,%.3f">%s %s-%s</a>' % (id, _in, _out, name, ox.format_timecode(_in), ox.format_timecode(_out))
|
||||||
data['descriptions'].append({
|
data['descriptions'].append({
|
||||||
'in': _start, 'out': _end-0.04, 'value': value
|
'in': _start, 'out': _end-0.04, 'value': value
|
||||||
})
|
})
|
||||||
|
@ -68,24 +68,23 @@ with open(target, 'w') as f:
|
||||||
'''
|
'''
|
||||||
import os
|
import os
|
||||||
import ox
|
import ox
|
||||||
|
import ox.api
|
||||||
|
|
||||||
with open(os.path.expanduser('~/.ox/client.json')) as f:
|
item = 'KFB'
|
||||||
config = json.load(f)
|
|
||||||
|
|
||||||
api = ox.API('https://pad.ma/api/')
|
api = ox.api.signin('https://pad.ma/api/')
|
||||||
r = api.signin(username=config['username'], password=config['password'])
|
request = {
|
||||||
|
'item': item,
|
||||||
|
}
|
||||||
|
if data['descriptions']:
|
||||||
|
request['layer'] = 'descriptions'
|
||||||
|
request['annotations'] = data['descriptions']
|
||||||
|
r = api.addAnnotations(request)
|
||||||
assert(r['status']['code'] == 200)
|
assert(r['status']['code'] == 200)
|
||||||
assert(r['data']['user'] != '')
|
|
||||||
for s in data['descriptions']:
|
if data['transcripts']:
|
||||||
s['item'] = 'BHK'
|
request['layer'] = 'transcripts'
|
||||||
s['layer'] = 'descriptions'
|
request['annotations'] = data['transcripts']
|
||||||
print s
|
r = api.addAnnotations(request)
|
||||||
r = api.addAnnotation(s)
|
|
||||||
assert(r['status']['code'] == 200)
|
|
||||||
for s in data['transcripts']:
|
|
||||||
s['item'] = 'BHK'
|
|
||||||
s['layer'] = 'transcripts'
|
|
||||||
print s
|
|
||||||
r = api.addAnnotation(s)
|
|
||||||
assert(r['status']['code'] == 200)
|
assert(r['status']['code'] == 200)
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue