mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
Fix incorrect paths for DVR and Plugins.
This commit is contained in:
parent
75816b5d8e
commit
41d7066d6e
8 changed files with 480 additions and 112 deletions
61
core/migrations/0016_update_dvr_template_paths.py
Normal file
61
core/migrations/0016_update_dvr_template_paths.py
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# Generated manually to update DVR template paths
|
||||
|
||||
from django.db import migrations
|
||||
from django.utils.text import slugify
|
||||
|
||||
|
||||
def update_dvr_template_paths(apps, schema_editor):
|
||||
"""Remove 'Recordings/' prefix from DVR template paths"""
|
||||
CoreSettings = apps.get_model("core", "CoreSettings")
|
||||
|
||||
# Define the updates needed
|
||||
updates = [
|
||||
(slugify("DVR TV Template"), "TV_Shows/{show}/S{season:02d}E{episode:02d}.mkv"),
|
||||
(slugify("DVR Movie Template"), "Movies/{title} ({year}).mkv"),
|
||||
(slugify("DVR TV Fallback Template"), "TV_Shows/{show}/{start}.mkv"),
|
||||
(slugify("DVR Movie Fallback Template"), "Movies/{start}.mkv"),
|
||||
]
|
||||
|
||||
# Update each setting
|
||||
for key, new_value in updates:
|
||||
try:
|
||||
setting = CoreSettings.objects.get(key=key)
|
||||
setting.value = new_value
|
||||
setting.save()
|
||||
print(f"Updated {setting.name}: {new_value}")
|
||||
except CoreSettings.DoesNotExist:
|
||||
print(f"Setting with key '{key}' not found - skipping")
|
||||
|
||||
|
||||
def reverse_dvr_template_paths(apps, schema_editor):
|
||||
"""Add back 'Recordings/' prefix to DVR template paths"""
|
||||
CoreSettings = apps.get_model("core", "CoreSettings")
|
||||
|
||||
# Define the reverse updates (add back Recordings/ prefix)
|
||||
updates = [
|
||||
(slugify("DVR TV Template"), "Recordings/TV_Shows/{show}/S{season:02d}E{episode:02d}.mkv"),
|
||||
(slugify("DVR Movie Template"), "Recordings/Movies/{title} ({year}).mkv"),
|
||||
(slugify("DVR TV Fallback Template"), "Recordings/TV_Shows/{show}/{start}.mkv"),
|
||||
(slugify("DVR Movie Fallback Template"), "Recordings/Movies/{start}.mkv"),
|
||||
]
|
||||
|
||||
# Update each setting back to original
|
||||
for key, original_value in updates:
|
||||
try:
|
||||
setting = CoreSettings.objects.get(key=key)
|
||||
setting.value = original_value
|
||||
setting.save()
|
||||
print(f"Reverted {setting.name}: {original_value}")
|
||||
except CoreSettings.DoesNotExist:
|
||||
print(f"Setting with key '{key}' not found - skipping")
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("core", "0015_dvr_templates"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(update_dvr_template_paths, reverse_dvr_template_paths),
|
||||
]
|
||||
|
|
@ -255,7 +255,7 @@ class CoreSettings(models.Model):
|
|||
return cls.objects.get(key=DVR_TV_FALLBACK_TEMPLATE_KEY).value
|
||||
except cls.DoesNotExist:
|
||||
# default requested by user
|
||||
return "Recordings/TV_Shows/{show}/{start}.mkv"
|
||||
return "TV_Shows/{show}/{start}.mkv"
|
||||
|
||||
@classmethod
|
||||
def get_dvr_movie_fallback_template(cls):
|
||||
|
|
@ -263,7 +263,7 @@ class CoreSettings(models.Model):
|
|||
try:
|
||||
return cls.objects.get(key=DVR_MOVIE_FALLBACK_TEMPLATE_KEY).value
|
||||
except cls.DoesNotExist:
|
||||
return "Recordings/Movies/{start}.mkv"
|
||||
return "Movies/{start}.mkv"
|
||||
|
||||
@classmethod
|
||||
def get_dvr_comskip_enabled(cls):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue