Use MediaServerType

This commit is contained in:
tcely 2025-02-12 06:34:29 -05:00 committed by GitHub
parent f8229fff11
commit 4a1c0016fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,7 +31,7 @@ from .utils import validate_url, delete_file
from .tasks import (map_task_to_instance, get_error_message,
get_source_completed_tasks, get_media_download_task,
delete_task_by_media, index_source_task)
from .choices import (YouTube_SourceType, youtube_long_source_types,
from .choices import (MediaServerType, YouTube_SourceType, youtube_long_source_types,
youtube_help, youtube_validation_urls)
from . import signals
from . import youtube
@ -897,13 +897,11 @@ class AddMediaServerView(FormView):
template_name = 'sync/mediaserver-add.html'
server_types = {
'plex': MediaServer.SERVER_TYPE_PLEX,
}
server_type_names = {
MediaServer.SERVER_TYPE_PLEX: _('Plex'),
'plex': MediaServerType.PLEX.value,
}
server_type_names = dict(MediaServerType.choices)
forms = {
MediaServer.SERVER_TYPE_PLEX: PlexMediaServerForm,
MediaServerType.PLEX.value: PlexMediaServerForm,
}
def __init__(self, *args, **kwargs):
@ -1020,7 +1018,7 @@ class UpdateMediaServerView(FormView, SingleObjectMixin):
template_name = 'sync/mediaserver-update.html'
model = MediaServer
forms = {
MediaServer.SERVER_TYPE_PLEX: PlexMediaServerForm,
MediaServerType.PLEX.value: PlexMediaServerForm,
}
def __init__(self, *args, **kwargs):