]> git.parisson.com Git - telemeta.git/commitdiff
fix playlist resource type
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 13 Nov 2015 14:45:28 +0000 (15:45 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 13 Nov 2015 14:45:28 +0000 (15:45 +0100)
telemeta/locale
telemeta/management/commands/telemeta-export-playlist-to-csv.py
telemeta/pages

index 4534a3d47e7909554637e87a637b1959db277941..91973b13f9dc9405052727c0c525d342dee15562 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 4534a3d47e7909554637e87a637b1959db277941
+Subproject commit 91973b13f9dc9405052727c0c525d342dee15562
index 185df544cf57bbb1f62f4180d7cceb8a065ce295..fd6f687e53ad9095fc00a1363ee410aa540ae4db 100644 (file)
@@ -10,7 +10,7 @@ from timeside.server.models import *
 from timeside.core.tools.test_samples import generateSamples
 from telemeta.models import *
 from telemeta.util.unicode import *
-
+from telemeta.views import PlaylistView
 
 class Command(BaseCommand):
     help = "Export all items or collections metadata to a CSV file"
@@ -18,14 +18,11 @@ class Command(BaseCommand):
     def handle(self, *args, **options):
         path = args[-1]
         public_id = args[-2]
+        resource_type = args[-3]
         f = open(path, 'w')
         playlist = Playlist.objects.get(public_id=public_id)
-        elements = []
-        for resource in playlist.resources.all():
-            if resource.resource_type == "item":
-                elements.append(MediaItem.objects.get(public_id=resource.resource_id))
-            elif resource.resource_type == "collection":
-                elements.append(MediaCollection.objects.get(public_id=resource.resource_id))
+        view = PlaylistView()
+        elements = view.get_elements(playlist, resource_type)
         writer = UnicodeWriter(f)
         csv = CSVExport(writer)
         csv.write(elements)
index ff2bfd95504603e16b17134aa774b392bf693ec0..f8324093174d077b674ac2c52eb0db6eaf815ab5 160000 (submodule)
@@ -1 +1 @@
-Subproject commit ff2bfd95504603e16b17134aa774b392bf693ec0
+Subproject commit f8324093174d077b674ac2c52eb0db6eaf815ab5