diff --git a/utils.py b/utils.py index f50e52e..b168e6a 100644 --- a/utils.py +++ b/utils.py @@ -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)