1 shell
j edited this page 2023-07-02 12:57:13 +05:30

collection of ./manage.py shell scripts

get item

import item.models
i = item.models.Item.objects.get(itemId='ABC')

get user

import user.models
u = user.models.User.objects.get(username='j')

find broken or aborted derivatives and encode again

import archive.models
import ox
for s in archive.models.Stream.objects.exclude(source=None):
    if s.info.get('duration', -1) < 0:
        print s
        s.encode()
        s.info = ox.avinfo(s.video.path)
        s.save()
        print s.info.get('duration')

extract timelines again

import item.models
i = item.models.Item.objects.get(itemId='ABC')
for s in i.streams(): s.make_timeline()
i.update_timeline()