Skip to content

Commit

Permalink
pre-populate default tv/movie quality profile in init script
Browse files Browse the repository at this point in the history
  • Loading branch information
lardbit committed Aug 2, 2024
1 parent fd2b354 commit a02a1ca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/nefarious/management/commands/nefarious-init.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from nefarious.models import NefariousSettings
from nefarious.models import NefariousSettings, QualityProfile
from nefarious.tmdb import get_tmdb_client
from nefarious.quality import PROFILE_HD_1080p, PROFILE_ANY


class Command(BaseCommand):
Expand All @@ -24,6 +25,11 @@ def handle(self, *args, **options):
# create settings if they don't already exist
nefarious_settings, _ = NefariousSettings.objects.get_or_create()

# assign default quality profiles
nefarious_settings.quality_profile_tv = QualityProfile.objects.get(profile=PROFILE_ANY)
nefarious_settings.quality_profile_movies = QualityProfile.objects.get(profile=PROFILE_HD_1080p)
nefarious_settings.save()

# populate tmdb configuration if necessary
if not nefarious_settings.tmdb_configuration or not nefarious_settings.tmdb_languages:
tmdb_client = get_tmdb_client(nefarious_settings)
Expand Down

0 comments on commit a02a1ca

Please sign in to comment.