30 lines
835 B
Python
30 lines
835 B
Python
|
import sys
|
||
|
import json
|
||
|
|
||
|
import ox
|
||
|
|
||
|
import archive.models
|
||
|
from archive.tasks import extract_stream
|
||
|
|
||
|
padma = json.load(open('/home/pandora/migration/padma/files.json'))
|
||
|
|
||
|
for id in padma:
|
||
|
fname = padma[id]['ogg']
|
||
|
if fname and os.path.exists(fname):
|
||
|
f = archive.models.File.objects.get(oshash=padma[id]['ogg_oshash'])
|
||
|
if not f.data:
|
||
|
print id, fname, f.item
|
||
|
f.data.name = f.get_path('data.ogv')
|
||
|
fdir = os.path.dirname(f.data.path)
|
||
|
ox.makedirs(fdir)
|
||
|
os.symlink(fname, f.data.path)
|
||
|
f.info.update(ox.avinfo(f.data.path))
|
||
|
f.info['extension'] = 'ogv'
|
||
|
f.info['type'] = 'video'
|
||
|
f.selected = True
|
||
|
del f.info['path']
|
||
|
f.parse_info()
|
||
|
f.save()
|
||
|
extract_stream.delay(f.id)
|
||
|
|