Skip to content

Commit

Permalink
Changing from config.ini to config.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus65535 committed Oct 14, 2023
1 parent d657941 commit c89da3e
Show file tree
Hide file tree
Showing 158 changed files with 36,462 additions and 745 deletions.
2 changes: 1 addition & 1 deletion bazarr/api/episodes/episodes_subtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def post(self):
provider = "manual"
score = 360
history_log(4, sonarrSeriesId, sonarrEpisodeId, result, fake_provider=provider, fake_score=score)
if not settings.general.getboolean('dont_notify_manual_actions'):
if not settings.general.dont_notify_manual_actions:
send_notifications(sonarrSeriesId, sonarrEpisodeId, result.message)
store_subtitles(result.path, episodePath)
except OSError:
Expand Down
2 changes: 1 addition & 1 deletion bazarr/api/movies/movies_subtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def post(self):
provider = "manual"
score = 120
history_log_movie(4, radarrId, result, fake_provider=provider, fake_score=score)
if not settings.general.getboolean('dont_notify_manual_actions'):
if not settings.general.dont_notify_manual_actions:
send_notifications_movie(radarrId, result.message)
store_subtitles_movie(result.path, moviePath)
except OSError:
Expand Down
2 changes: 1 addition & 1 deletion bazarr/api/providers/providers_episodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def post(self):
result = result[0]
if isinstance(result, ProcessSubtitlesResult):
history_log(2, sonarrSeriesId, sonarrEpisodeId, result)
if not settings.general.getboolean('dont_notify_manual_actions'):
if not settings.general.dont_notify_manual_actions:
send_notifications(sonarrSeriesId, sonarrEpisodeId, result.message)
store_subtitles(result.path, episodePath)
elif isinstance(result, str):
Expand Down
2 changes: 1 addition & 1 deletion bazarr/api/providers/providers_movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def post(self):
result = result[0]
if isinstance(result, ProcessSubtitlesResult):
history_log_movie(2, radarrId, result)
if not settings.general.getboolean('dont_notify_manual_actions'):
if not settings.general.dont_notify_manual_actions:
send_notifications_movie(radarrId, result.message)
store_subtitles_movie(result.path, moviePath)
elif isinstance(result, str):
Expand Down
2 changes: 1 addition & 1 deletion bazarr/api/subtitles/subtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def patch(self):

# apply chmod if required
chmod = int(settings.general.chmod, 8) if not sys.platform.startswith(
'win') and settings.general.getboolean('chmod_enabled') else None
'win') and settings.general.chmod_enabled else None
if chmod:
os.chmod(subtitles_path, chmod)

Expand Down
4 changes: 2 additions & 2 deletions bazarr/api/system/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class SystemAccount(Resource):
@api_ns_system_account.response(400, 'Unknown action')
@api_ns_system_account.response(403, 'Authentication failed')
@api_ns_system_account.response(406, 'Browser must be closed to invalidate basic authentication')
@api_ns_system_account.response(500, 'Unknown authentication type define in config.ini')
@api_ns_system_account.response(500, 'Unknown authentication type define in config')
def post(self):
"""Login or logout from Bazarr UI when using form login"""
args = self.post_request_parser.parse_args()
if settings.auth.type != 'form':
return 'Unknown authentication type define in config.ini', 500
return 'Unknown authentication type define in config', 500

action = args.get('action')
if action == 'login':
Expand Down
4 changes: 2 additions & 2 deletions bazarr/api/system/searches.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get(self):
search_list = []

if query:
if settings.general.getboolean('use_sonarr'):
if settings.general.use_sonarr:
# Get matching series
search_list += database.execute(
select(TableShows.title,
Expand All @@ -36,7 +36,7 @@ def get(self):
.order_by(TableShows.title)) \
.all()

if settings.general.getboolean('use_radarr'):
if settings.general.use_radarr:
# Get matching movies
search_list += database.execute(
select(TableMovies.title,
Expand Down
16 changes: 11 additions & 5 deletions bazarr/api/system/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from flask import request, jsonify
from flask_restx import Resource, Namespace
from dynaconf.validator import ValidationError

from app.database import TableLanguagesProfiles, TableSettingsLanguages, TableSettingsNotifier, \
update_profile_id_list, database, insert, update, delete, select
Expand Down Expand Up @@ -97,9 +98,9 @@ def post(self):

event_stream("languages")

if settings.general.getboolean('use_sonarr'):
if settings.general.use_sonarr:
scheduler.add_job(list_missing_subtitles, kwargs={'send_event': True})
if settings.general.getboolean('use_radarr'):
if settings.general.use_radarr:
scheduler.add_job(list_missing_subtitles_movies, kwargs={'send_event': True})

# Update Notification
Expand All @@ -112,6 +113,11 @@ def post(self):
url=item['url'])
.where(TableSettingsNotifier.name == item['name']))

save_settings(zip(request.form.keys(), request.form.listvalues()))
event_stream("settings")
return '', 204
try:
save_settings(zip(request.form.keys(), request.form.listvalues()))
except ValidationError as e:
event_stream("settings")
return e.message, 406
else:
event_stream("settings")
return '', 204
2 changes: 1 addition & 1 deletion bazarr/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def postprocess(item):
"hi": language[1] == 'hi',
}
)
if settings.general.getboolean('embedded_subs_show_desired') and item.get('profileId'):
if settings.general.embedded_subs_show_desired and item.get('profileId'):
desired_lang_list = get_desired_languages(item['profileId'])
item['subtitles'] = [x for x in item['subtitles'] if x['code2'] in desired_lang_list or x['path']]
item['subtitles'] = sorted(item['subtitles'], key=itemgetter('name', 'forced'))
Expand Down

0 comments on commit c89da3e

Please sign in to comment.