diff --git a/src/frontend/src/app/api.service.ts b/src/frontend/src/app/api.service.ts index 4a16c86e..43b278fe 100644 --- a/src/frontend/src/app/api.service.ts +++ b/src/frontend/src/app/api.service.ts @@ -39,7 +39,7 @@ export class ApiService { API_URL_GENRES_MOVIE = '/api/genres/movie/'; API_URL_GENRES_TV = '/api/genres/tv/'; API_URL_MEDIA_CATEGORIES = '/api/media-categories/'; - API_URL_QUALITY_PROFILES = '/api/quality-profiles/'; + API_URL_QUALITY_PROFILES = '/api/quality-profile/'; API_URL_GIT_COMMIT = '/api/git-commit/'; API_URL_IMPORT_MEDIA_TV = '/api/import/media/tv/'; API_URL_IMPORT_MEDIA_MOVIE = '/api/import/media/movie/'; @@ -55,7 +55,7 @@ export class ApiService { public userToken: string; public users: any; // staff-only list of all users public settings: any; - public qualityProfiles: string[]; + public qualityProfiles: any[] = []; public mediaCategories: string[]; public watchTVSeasons: any[] = []; public watchTVSeasonRequests: any[] = []; @@ -240,8 +240,8 @@ export class ApiService { public fetchQualityProfiles() { return this.http.get(this.API_URL_QUALITY_PROFILES, {headers: this._requestHeaders()}).pipe( map((data: any) => { - if (data.profiles) { - this.qualityProfiles = data.profiles; + if (data.length) { + this.qualityProfiles = data; } else { console.error('no quality profiles'); } diff --git a/src/frontend/src/app/settings/settings.component.html b/src/frontend/src/app/settings/settings.component.html index 8ff9f9b9..4e62a1ff 100644 --- a/src/frontend/src/app/settings/settings.component.html +++ b/src/frontend/src/app/settings/settings.component.html @@ -95,13 +95,13 @@
diff --git a/src/frontend/src/app/settings/settings.component.ts b/src/frontend/src/app/settings/settings.component.ts index 67d3c736..41777b05 100644 --- a/src/frontend/src/app/settings/settings.component.ts +++ b/src/frontend/src/app/settings/settings.component.ts @@ -50,7 +50,6 @@ export class SettingsComponent implements OnInit, AfterContentChecked { 'open_subtitles_username': [settings['open_subtitles_username']], 'open_subtitles_password': [settings['open_subtitles_password']], 'open_subtitles_auto': [settings['open_subtitles_auto']], - // TODO - use QualityProfile primary key 'quality_profile_tv': [settings['quality_profile_tv'], Validators.required], 'quality_profile_movies': [settings['quality_profile_movies'], Validators.required], 'allow_hardcoded_subs': [settings['allow_hardcoded_subs'], Validators.required], @@ -114,7 +113,7 @@ export class SettingsComponent implements OnInit, AfterContentChecked { ).subscribe(); } - public qualityProfiles(): string[] { + public qualityProfiles(): any[] { return this.apiService.qualityProfiles; } diff --git a/src/nefarious/api/serializers.py b/src/nefarious/api/serializers.py index d74e9a58..78ae4086 100644 --- a/src/nefarious/api/serializers.py +++ b/src/nefarious/api/serializers.py @@ -22,6 +22,12 @@ def get_requested_by(self, watch_media): return watch_media.user.username +class QualityProfileSerializer(serializers.ModelSerializer): + class Meta: + model = QualityProfile + fields = '__all__' + + class NefariousSettingsSerializer(serializers.ModelSerializer): tmdb_configuration = serializers.JSONField(required=False) keyword_search_filters = serializers.JSONField(required=False) @@ -30,9 +36,6 @@ class NefariousSettingsSerializer(serializers.ModelSerializer): websocket_url = serializers.SerializerMethodField() is_debug = serializers.SerializerMethodField() host_download_path = serializers.SerializerMethodField() - # TODO - need to handle saving - quality_profile_tv = serializers.SerializerMethodField() - quality_profile_movies = serializers.SerializerMethodField() def get_websocket_url(self, obj): return settings.WEBSOCKET_URL @@ -43,12 +46,6 @@ def get_is_debug(self, obj): def get_host_download_path(self, obj): return settings.HOST_DOWNLOAD_PATH - def get_quality_profile_tv(self, obj): - return QualityProfileSerializer(obj.quality_profile_tv).data - - def get_quality_profile_movies(self, obj): - return QualityProfileSerializer(obj.quality_profile_movies).data - class Meta: model = NefariousSettings fields = '__all__' @@ -223,9 +220,3 @@ class TorrentBlacklistSerializer(serializers.ModelSerializer): class Meta: model = TorrentBlacklist fields = '__all__' - - -class QualityProfileSerializer(serializers.ModelSerializer): - class Meta: - model = QualityProfile - fields = '__all__' diff --git a/src/nefarious/api/urls.py b/src/nefarious/api/urls.py index cd6eb56b..d8f3fd27 100644 --- a/src/nefarious/api/urls.py +++ b/src/nefarious/api/urls.py @@ -34,7 +34,6 @@ path('import/media//', views.ImportMediaLibraryView.as_view()), path('genres//', views.GenresView.as_view()), path('media-categories/', views.MediaCategoriesView.as_view()), - path('quality-profiles/', views.QualityProfilesView.as_view()), path('auth/', views.ObtainAuthTokenView.as_view()), # authenticates user and returns token path('git-commit/', views.GitCommitView.as_view()), # returns this app's git commit path('open-subtitles/auth/', views.OpenSubtitlesAuthView.as_view()), # auths against open subtitles diff --git a/src/nefarious/api/views.py b/src/nefarious/api/views.py index 3802e6ff..961cb6a5 100644 --- a/src/nefarious/api/views.py +++ b/src/nefarious/api/views.py @@ -507,13 +507,6 @@ def get(self, request, media_type: str): }) -@method_decorator(gzip_page, name='dispatch') -class QualityProfilesView(views.APIView): - - def get(self, request): - return Response({'profiles': [p.name for p in PROFILES]}) - - @method_decorator(gzip_page, name='dispatch') class MediaCategoriesView(views.APIView):