following episode function good, need to work on the random episode and more admin stuff
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7s
This commit is contained in:
@@ -1,3 +1,76 @@
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import redirect
|
||||
from six import print_
|
||||
from .models import StreamingRedirectData
|
||||
from .utils import randomEpisode,followingEpisode
|
||||
from apps.betaserie.utils import betaserieUtils
|
||||
|
||||
betaserie = betaserieUtils()
|
||||
|
||||
|
||||
# Create your views here.
|
||||
def hello(request):
|
||||
return HttpResponse('<h1>Hello streaming view!</h1>')
|
||||
|
||||
|
||||
def streamingRedirect(request,alias):
|
||||
streaming_object = StreamingRedirectData.objects.filter(alias=alias)
|
||||
|
||||
episode = streaming_object.values('episode')[0]['episode']
|
||||
season = streaming_object.values('season')[0]['season']
|
||||
seasonInformation = streaming_object.values('seasonInformation')[0]['seasonInformation']
|
||||
|
||||
url_prefix = streaming_object.values('prefix')[0]['prefix']
|
||||
url_infix = streaming_object.values('infix')[0]['infix']
|
||||
url_suffix = streaming_object.values('suffix')[0]['suffix'] or ''
|
||||
|
||||
betaserieShowId = streaming_object.values('betaserieShowId')[0]['betaserieShowId']
|
||||
|
||||
print(url_prefix)
|
||||
|
||||
print(season)
|
||||
print(episode)
|
||||
|
||||
|
||||
print(seasonInformation)
|
||||
|
||||
value = str(streaming_object.values('url_example'))
|
||||
print(value)
|
||||
|
||||
url_example = str(streaming_object.values('url_example')[0]['url_example'])
|
||||
print(url_example)
|
||||
|
||||
randomViewing =str(streaming_object.values('randomViewing')[0]['randomViewing'])
|
||||
print(randomViewing)
|
||||
|
||||
if (randomViewing == False):
|
||||
print('show set to random')
|
||||
season,episode = randomEpisode()
|
||||
else:
|
||||
print('show set to following episode')
|
||||
season,episode,lastEpisode = followingEpisode(season,episode,seasonInformation)
|
||||
if (lastEpisode):
|
||||
return HttpResponse('<h1>You already watched the last episode of the serie!</h1>')
|
||||
|
||||
print(season)
|
||||
print(episode)
|
||||
|
||||
|
||||
url_generated = str(url_prefix)+str(season)+str(url_infix)+str(episode)+str(url_suffix)
|
||||
print(url_generated)
|
||||
|
||||
|
||||
#append the data into the model
|
||||
StreamingRedirectData.objects.filter(alias=alias).update(season=season,episode=episode)
|
||||
|
||||
#### mark as view in betaserie
|
||||
|
||||
#mark episode as seen in betaserie
|
||||
episode_number = "S"+str(season)+"E"+str(episode)
|
||||
|
||||
episode_id = betaserie.identify_episode(betaserieShowId,episode_number)
|
||||
|
||||
betaserie.mark_episodes_watched(episode_id)
|
||||
|
||||
|
||||
return redirect(str(url_generated))
|
||||
Reference in New Issue
Block a user