Set license constants.
[audio.git] / src / youtube / models.py
index ea51905..1a3fd01 100644 (file)
@@ -1,6 +1,7 @@
 import io
 from os import unlink
 from tempfile import NamedTemporaryFile
+from django.conf import settings
 from django.db import models
 from django.utils.translation import gettext_lazy as _
 from django.template import Template, Context
@@ -42,7 +43,11 @@ class YouTube(models.Model):
         verbose_name_plural = _("YouTube configurations")
 
     def get_context(self, audiobook):
-        return Context(dict(audiobook=audiobook))
+        return Context(dict(
+            audiobook=audiobook,
+            LICENSE=settings.LICENSE,
+            LICENSE_NAME=settings.LICENSE_NAME,
+        ))
 
     def get_description(self, audiobook):
         return Template(self.description_template).render(self.get_context(audiobook))
@@ -56,7 +61,8 @@ class YouTube(models.Model):
                 title=self.get_title(audiobook),
                 description=self.get_description(audiobook),
                 categoryId=self.category,
-                defaultLanguage='pl'
+                defaultLanguage='pl',
+                defaultAudioLanguage='pl',
             ),
             status=dict(
                 privacyStatus=self.privacy_status,