1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2025-02-23 22:41:34 +00:00

Fixed languages profile creation issue.

This commit is contained in:
morpheus65535 2023-11-10 13:57:56 -05:00
parent b87aef8763
commit cb3a274894

View file

@ -6,6 +6,7 @@ from flask import request, jsonify
from flask_restx import Resource, Namespace from flask_restx import Resource, Namespace
from dynaconf.validator import ValidationError from dynaconf.validator import ValidationError
from api.utils import None_Keys
from app.database import TableLanguagesProfiles, TableSettingsLanguages, TableSettingsNotifier, \ from app.database import TableLanguagesProfiles, TableSettingsLanguages, TableSettingsNotifier, \
update_profile_id_list, database, insert, update, delete, select update_profile_id_list, database, insert, update, delete, select
from app.event_handler import event_stream from app.event_handler import event_stream
@ -66,11 +67,12 @@ class SystemSettings(Resource):
update(TableLanguagesProfiles) update(TableLanguagesProfiles)
.values( .values(
name=item['name'], name=item['name'],
cutoff=item['cutoff'] if item['cutoff'] != 'null' else None, cutoff=item['cutoff'] if item['cutoff'] not in None_Keys else None,
items=json.dumps(item['items']), items=json.dumps(item['items']),
mustContain=str(item['mustContain']), mustContain=str(item['mustContain']),
mustNotContain=str(item['mustNotContain']), mustNotContain=str(item['mustNotContain']),
originalFormat=int(item['originalFormat']) if item['originalFormat'] != 'null' else None, originalFormat=int(item['originalFormat']) if item['originalFormat'] not in None_Keys else
None,
) )
.where(TableLanguagesProfiles.profileId == item['profileId'])) .where(TableLanguagesProfiles.profileId == item['profileId']))
existing.remove(item['profileId']) existing.remove(item['profileId'])
@ -81,11 +83,12 @@ class SystemSettings(Resource):
.values( .values(
profileId=item['profileId'], profileId=item['profileId'],
name=item['name'], name=item['name'],
cutoff=item['cutoff'] if item['cutoff'] != 'null' else None, cutoff=item['cutoff'] if item['cutoff'] not in None_Keys else None,
items=json.dumps(item['items']), items=json.dumps(item['items']),
mustContain=str(item['mustContain']), mustContain=str(item['mustContain']),
mustNotContain=str(item['mustNotContain']), mustNotContain=str(item['mustNotContain']),
originalFormat=int(item['originalFormat']) if item['originalFormat'] != 'null' else None, originalFormat=int(item['originalFormat']) if item['originalFormat'] not in None_Keys else
None,
)) ))
for profileId in existing: for profileId in existing:
# Remove deleted profiles # Remove deleted profiles