fix import

This commit is contained in:
j 2023-11-15 18:10:19 +01:00
parent fa7d6fb8bc
commit 18bf1d15cb

View file

@ -5,18 +5,20 @@ import shutil
import tempfile
from archive.models import File, Stream, User
from archive.external import get_info
from archive.external import get_info, add_subtitles
def import_items(items):
import item.models
for data in items:
i = item.models.Item()
i.data = data
i.user = User.objects.all()[0]
i.save()
i.edit(data, True)
i.level = 0
i.save()
load_vimeo(i)
print(i)
def load_vimeo(item):
urls = [url for url in item.data.get("links", []) if "vimeo.com" in url]
@ -80,5 +82,5 @@ def load_vimeo(item):
add_subtitles(item, media, tmp)
item.update_timeline()
item.save()
o.chdir(cdir)
os.chdir(cdir)
shutil.rmtree(tmp)