fix import
This commit is contained in:
parent
fa7d6fb8bc
commit
18bf1d15cb
1 changed files with 6 additions and 4 deletions
10
utils.py
10
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)
|
||||
|
|
Loading…
Reference in a new issue