mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
Comskip Update
This commit is contained in:
parent
c76d68f382
commit
f652d2b233
9 changed files with 329 additions and 7 deletions
23
core/migrations/0016_dvr_comskip_enabled.py
Normal file
23
core/migrations/0016_dvr_comskip_enabled.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
from django.db import migrations
|
||||
from django.utils.text import slugify
|
||||
|
||||
|
||||
def add_comskip_setting(apps, schema_editor):
|
||||
CoreSettings = apps.get_model("core", "CoreSettings")
|
||||
key = slugify("DVR Comskip Enabled")
|
||||
CoreSettings.objects.get_or_create(
|
||||
key=key,
|
||||
defaults={"name": "DVR Comskip Enabled", "value": "false"},
|
||||
)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("core", "0015_dvr_templates"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(add_comskip_setting),
|
||||
]
|
||||
|
||||
|
|
@ -157,6 +157,7 @@ DVR_SERIES_RULES_KEY = slugify("DVR Series Rules")
|
|||
DVR_TV_FALLBACK_DIR_KEY = slugify("DVR TV Fallback Dir")
|
||||
DVR_TV_FALLBACK_TEMPLATE_KEY = slugify("DVR TV Fallback Template")
|
||||
DVR_MOVIE_FALLBACK_TEMPLATE_KEY = slugify("DVR Movie Fallback Template")
|
||||
DVR_COMSKIP_ENABLED_KEY = slugify("DVR Comskip Enabled")
|
||||
|
||||
|
||||
class CoreSettings(models.Model):
|
||||
|
|
@ -262,6 +263,15 @@ class CoreSettings(models.Model):
|
|||
except cls.DoesNotExist:
|
||||
return "Recordings/Movies/{start}.mkv"
|
||||
|
||||
@classmethod
|
||||
def get_dvr_comskip_enabled(cls):
|
||||
"""Return boolean-like string value ('true'/'false') for comskip enablement."""
|
||||
try:
|
||||
val = cls.objects.get(key=DVR_COMSKIP_ENABLED_KEY).value
|
||||
return str(val).lower() in ("1", "true", "yes", "on")
|
||||
except cls.DoesNotExist:
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def get_dvr_series_rules(cls):
|
||||
"""Return list of series recording rules. Each: {tvg_id, title, mode: 'all'|'new'}"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue