Files
Django_kube/django_code/apps/streaming/models.py
T
pi-ux-ce b6e60764bd
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
change default
2026-08-07 16:29:29 +01:00

49 lines
2.1 KiB
Python

from django.db import models
from apps.betaserie.utils import betaserieUtils
# Create your models here.
class StreamingSiteTestingData(models.Model):
url = models.CharField(max_length=1000)
addedDate = models.DateField('Published', blank=True, null=True, auto_now_add=True)
status = models.CharField(max_length=1000, blank=True, null=True)
result = models.CharField(max_length=1000, blank=True, null=True)
class Meta:
db_table = 'streaming'
class StreamingRedirectData(models.Model):
name = models.CharField(primary_key=True,max_length=1000, help_text="Name of the show")
season_to_watch = models.IntegerField(null=False,default=1)
episode_to_watch = models.IntegerField(null=False,default=1)
url_example = models.CharField(max_length=1000, help_text="https://www.1shows.org/tv/456-the-simpsons?streaming=true&season=18&episode=5")
prefix = models.CharField(max_length=1000, help_text="https://www.1shows.org/tv/456-the-simpsons?streaming=true&season=",blank=True, null=True)
infix = models.CharField(max_length=1000, help_text="&episode=",blank=True, null=True)
suffix = models.CharField(max_length=1000, help_text="" ,blank=True, null=True)
addedDate = models.DateField('Published', blank=True, null=True, auto_now_add=True)
alias = models.CharField(max_length=1000, null=True,blank=True)
seasonInformation = models.JSONField(default="{}",max_length=1000,blank=True)
def sanitize(self, name):
return name.replace(" ", "")
def season_information(self, serie_name):
betaserie = betaserieUtils()
print(serie_name)
print(betaserie.identify_serie(serie_name))
return betaserie.series_information(betaserie.identify_serie(serie_name))[0]
def save(self, *args, **kwargs):
if not self.seasonInformation :
self.seasonInformation = self.season_information(self.name)
if not self.alias:
self.alias = self.sanitize(self.name)
super().save(*args, **kwargs)
class Meta:
db_table = 'StreamingRedirect'