Testing #28
@@ -1,7 +1,7 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
from import_export.admin import ImportExportModelAdmin
|
from import_export.admin import ImportExportModelAdmin
|
||||||
from .models import streamingData
|
from .models import StreamingSiteTestingData,StreamingRedirectData
|
||||||
from .utils import full_testing
|
from .utils import full_testing
|
||||||
from urllib.parse import urlsplit, urlunsplit
|
from urllib.parse import urlsplit, urlunsplit
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ def urlcleaning(modeladmin, request, queryset):
|
|||||||
print("Cleaning :"+str(base_url))
|
print("Cleaning :"+str(base_url))
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@admin.register(streamingData)
|
@admin.register(StreamingSiteTestingData)
|
||||||
class streamingAdmin(ImportExportModelAdmin):
|
class streamingAdmin(ImportExportModelAdmin):
|
||||||
list_display = ['clickable_links','result_colored','newstatus']
|
list_display = ['clickable_links','result_colored','newstatus']
|
||||||
fields = ['url']
|
fields = ['url']
|
||||||
@@ -68,4 +68,9 @@ class streamingAdmin(ImportExportModelAdmin):
|
|||||||
if obj.status != '200':
|
if obj.status != '200':
|
||||||
return format_html('<div style="width:100%%; height:100%%; background-color:orange;">{}</div>', obj.status)
|
return format_html('<div style="width:100%%; height:100%%; background-color:orange;">{}</div>', obj.status)
|
||||||
#return obj.status
|
#return obj.status
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(StreamingRedirectData)
|
||||||
|
class StreamingRedirectAdmin(ImportExportModelAdmin):
|
||||||
|
list_display = ['name','season_to_watch','episode_to_watch','addedDate','url_example','addedDate','alias']
|
||||||
|
fields = ['name','season_to_watch','episode_to_watch','url_example','prefix','infix','suffix','alias','seasonInformation']
|
||||||
|
|||||||
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
# Generated by Django 4.2.30 on 2026-08-07 11:00
|
# Generated by Django 4.2.30 on 2026-08-07 13:13
|
||||||
|
|
||||||
import apps.streaming.models
|
import apps.streaming.models
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
@@ -12,7 +12,7 @@ class Migration(migrations.Migration):
|
|||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='urlData',
|
name='StreamingRedirectData',
|
||||||
fields=[
|
fields=[
|
||||||
('name', models.CharField(help_text='Name of the show', max_length=1000, primary_key=True, serialize=False)),
|
('name', models.CharField(help_text='Name of the show', max_length=1000, primary_key=True, serialize=False)),
|
||||||
('url_example', models.CharField(help_text='https://www.1shows.org/tv/456-the-simpsons?streaming=true&season=18&episode=5', max_length=1000)),
|
('url_example', models.CharField(help_text='https://www.1shows.org/tv/456-the-simpsons?streaming=true&season=18&episode=5', max_length=1000)),
|
||||||
@@ -20,10 +20,10 @@ class Migration(migrations.Migration):
|
|||||||
('infix', models.CharField(blank=True, help_text='&episode=', max_length=1000, null=True)),
|
('infix', models.CharField(blank=True, help_text='&episode=', max_length=1000, null=True)),
|
||||||
('suffix', models.CharField(blank=True, max_length=1000, null=True)),
|
('suffix', models.CharField(blank=True, max_length=1000, null=True)),
|
||||||
('addedDate', models.DateField(auto_now_add=True, null=True, verbose_name='Published')),
|
('addedDate', models.DateField(auto_now_add=True, null=True, verbose_name='Published')),
|
||||||
('alias', models.CharField(default=apps.streaming.models.urlData.sanitize, max_length=1000)),
|
('alias', models.CharField(default=apps.streaming.models.StreamingRedirectData.sanitize, max_length=1000)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'db_table': 'redirectUrl',
|
'db_table': 'StreamingRedirect',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
# Generated by Django 4.2.30 on 2026-08-07 14:02
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('streaming', '0003_streamingredirectdata'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='streamingredirectdata',
|
||||||
|
name='episode_to_watch',
|
||||||
|
field=models.IntegerField(default=1),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='streamingredirectdata',
|
||||||
|
name='season_to_watch',
|
||||||
|
field=models.IntegerField(default=1),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='streamingredirectdata',
|
||||||
|
name='alias',
|
||||||
|
field=models.CharField(blank=True, max_length=1000, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.2.30 on 2026-08-07 14:49
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('streaming', '0004_streamingredirectdata_episode_to_watch_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='streamingredirectdata',
|
||||||
|
name='hello',
|
||||||
|
field=models.CharField(blank=True, max_length=1000, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
# Generated by Django 4.2.30 on 2026-08-07 14:55
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('streaming', '0005_streamingredirectdata_hello'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='streamingredirectdata',
|
||||||
|
name='hello',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='streamingredirectdata',
|
||||||
|
name='seasonInformation',
|
||||||
|
field=models.JSONField(blank=True, max_length=1000, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
# Generated by Django 4.2.30 on 2026-08-07 15:22
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('streaming', '0006_remove_streamingredirectdata_hello_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameModel(
|
||||||
|
old_name='streamingData',
|
||||||
|
new_name='StreamingSiteTestingData',
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='streamingredirectdata',
|
||||||
|
name='seasonInformation',
|
||||||
|
field=models.JSONField(blank=True, default='', max_length=1000),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
from apps.betaserie.utils import betaserieUtils
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class streamingData(models.Model):
|
class StreamingSiteTestingData(models.Model):
|
||||||
url = models.CharField(max_length=1000)
|
url = models.CharField(max_length=1000)
|
||||||
addedDate = models.DateField('Published', blank=True, null=True, auto_now_add=True)
|
addedDate = models.DateField('Published', blank=True, null=True, auto_now_add=True)
|
||||||
status = models.CharField(max_length=1000, blank=True, null=True)
|
status = models.CharField(max_length=1000, blank=True, null=True)
|
||||||
@@ -10,19 +13,37 @@ class streamingData(models.Model):
|
|||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'streaming'
|
db_table = 'streaming'
|
||||||
|
|
||||||
class urlData(models.Model):
|
|
||||||
def sanitize(self):
|
|
||||||
print(self)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class StreamingRedirectData(models.Model):
|
||||||
name = models.CharField(primary_key=True,max_length=1000, help_text="Name of the show")
|
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")
|
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)
|
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)
|
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)
|
suffix = models.CharField(max_length=1000, help_text="" ,blank=True, null=True)
|
||||||
addedDate = models.DateField('Published', blank=True, null=True, auto_now_add=True)
|
addedDate = models.DateField('Published', blank=True, null=True, auto_now_add=True)
|
||||||
alias = models.CharField(max_length=1000, default=sanitize)
|
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:
|
class Meta:
|
||||||
db_table = 'redirectUrl'
|
db_table = 'StreamingRedirect'
|
||||||
Reference in New Issue
Block a user