From 2ddbd2215310234b324a5de894d5c8cb0bd1463c Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Fri, 30 Mar 2018 00:40:06 +0200 Subject: [PATCH] Add export function --- .../commands/telemeta-export-items-from-user-playlists.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/telemeta/management/commands/telemeta-export-items-from-user-playlists.py b/telemeta/management/commands/telemeta-export-items-from-user-playlists.py index fee9519b..3d98ca17 100644 --- a/telemeta/management/commands/telemeta-export-items-from-user-playlists.py +++ b/telemeta/management/commands/telemeta-export-items-from-user-playlists.py @@ -6,6 +6,7 @@ from django.template.defaultfilters import slugify from django.utils import translation from telemeta.models import Playlist, MediaCollection, MediaItem +from telemeta.views.item import ItemView class Command(BaseCommand): @@ -14,9 +15,12 @@ class Command(BaseCommand): def handle(self, *args, **options): username = args[0] + extension = args[1] + user = User.objects.get(username=username) playlists = user.playlists.all() items = [] + view = ItemView() for playlist in playlists: resources = playlist.resources.all() @@ -29,5 +33,5 @@ class Command(BaseCommand): item = MediaItem.objects.get(id=resource.resource_id) items.append(item) - print(items) - + for item in items: + view.item_transcode(item, extension) -- 2.39.5