add ogv reipmort

This commit is contained in:
j 2013-05-07 17:52:44 +02:00
parent e76ea7adb7
commit ecc80de5db

29
import_ogv.py Normal file
View file

@ -0,0 +1,29 @@
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)