add ogv reipmort
This commit is contained in:
parent
e76ea7adb7
commit
ecc80de5db
1 changed files with 29 additions and 0 deletions
29
import_ogv.py
Normal file
29
import_ogv.py
Normal 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)
|
||||||
|
|
Loading…
Reference in a new issue