film pages

This commit is contained in:
j 2021-11-21 10:09:26 +01:00
commit c06436433f
10 changed files with 480 additions and 28 deletions

View file

@ -1,4 +1,5 @@
import logging
import json
from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorators.csrf import csrf_exempt
@ -20,12 +21,16 @@ def get_ip(request):
return ip
def get_stream_prefix(request):
prefix = "https://v2.phantas.ma/"
return settings.DEFAULT_PANDORA_API.replace('/api/', '/')
'''
domain = settings.DEFAULT_PANDORA_API.split('/')[3]
prefix = "https://v2.%s/" % domain
cdn = {
'Eastern Asia': "https://v1.phantas.ma/",
'Southern Asia': "https://v1.phantas.ma/",
'Asia': "https://v1.phantas.ma/",
'Eastern Asia': "https://v1.%s/" % domain,
'Southern Asia': "https://v1.%s/" % domain,
'Asia': "https://v1.%s/" % domain,
}
'''
ip = get_ip(request)
try:
g = GeoIP2()
@ -54,13 +59,17 @@ def film(request, slug):
context['film'] = get_object_or_404(models.Film, slug=slug)
context['settings'] = settings
context['stream_prefix'] = get_stream_prefix(request)
context['pandora_url'] = settings.DEFAULT_PANDORA_API.replace('/api/', '')
return render(request, 'film.html', context)
def film_play(request, slug, lang):
def film_play(request, slug, id):
context = {}
context['film'] = get_object_or_404(models.Film, slug=slug)
context['lang'] = lang
context['settings'] = settings
context['config'] = json.dumps({
'stream_prefix': get_stream_prefix(request),
'item': id
})
context['pandora_url'] = settings.DEFAULT_PANDORA_API.replace('/api/', '')
return render(request, 'film_play.html', context)
def edits(request):