mirror of
https://github.com/chibicitiberiu/ytsm.git
synced 2024-02-24 05:43:31 +00:00
Began work on refactoring the YTSM application.
This commit is contained in:
@ -6,8 +6,8 @@ from YtManagerApp.dynamic_preferences_registry import MarkDeletedAsWatched, Auto
|
||||
DownloadGlobalLimit, DownloadGlobalSizeLimit, DownloadSubscriptionLimit, DownloadMaxAttempts, DownloadOrder, \
|
||||
DownloadPath, DownloadFilePattern, DownloadFormat, DownloadSubtitles, DownloadAutogeneratedSubtitles, \
|
||||
DownloadAllSubtitles, DownloadSubtitlesLangs, DownloadSubtitlesFormat
|
||||
from YtManagerApp.management.appconfig import appconfig
|
||||
from YtManagerApp.models import VIDEO_ORDER_CHOICES
|
||||
from YtManagerApp.services import Services
|
||||
|
||||
|
||||
class SettingsForm(forms.Form):
|
||||
@ -234,25 +234,25 @@ class AdminSettingsForm(forms.Form):
|
||||
@staticmethod
|
||||
def get_initials():
|
||||
return {
|
||||
'api_key': appconfig.youtube_api_key,
|
||||
'allow_registrations': appconfig.allow_registrations,
|
||||
'sync_schedule': appconfig.sync_schedule,
|
||||
'scheduler_concurrency': appconfig.concurrency,
|
||||
'api_key': Services.appConfig.youtube_api_key,
|
||||
'allow_registrations': Services.appConfig.allow_registrations,
|
||||
'sync_schedule': Services.appConfig.sync_schedule,
|
||||
'scheduler_concurrency': Services.appConfig.concurrency,
|
||||
}
|
||||
|
||||
def save(self):
|
||||
api_key = self.cleaned_data['api_key']
|
||||
if api_key is not None and len(api_key) > 0:
|
||||
appconfig.youtube_api_key = api_key
|
||||
Services.appConfig.youtube_api_key = api_key
|
||||
|
||||
allow_registrations = self.cleaned_data['allow_registrations']
|
||||
if allow_registrations is not None:
|
||||
appconfig.allow_registrations = allow_registrations
|
||||
Services.appConfig.allow_registrations = allow_registrations
|
||||
|
||||
sync_schedule = self.cleaned_data['sync_schedule']
|
||||
if sync_schedule is not None and len(sync_schedule) > 0:
|
||||
appconfig.sync_schedule = sync_schedule
|
||||
Services.appConfig.sync_schedule = sync_schedule
|
||||
|
||||
concurrency = self.cleaned_data['scheduler_concurrency']
|
||||
if concurrency is not None:
|
||||
appconfig.concurrency = concurrency
|
||||
Services.appConfig.concurrency = concurrency
|
||||
|
Reference in New Issue
Block a user