Commit 8a332010 authored by echel0n's avatar echel0n
Browse files

fixed issue with show language now displaying correcting in edit show view

added code to migrate series provider default language from 2-code to 3-code
parent 3aa0d176
This diff is collapsed.
"""Initial migration
Revision ID: 4
Revises:
Create Date: 2017-12-29 14:39:27.854291
"""
import babelfish
from alembic import op
# revision identifiers, used by Alembic.
revision = '5'
down_revision = '4'
def upgrade():
conn = op.get_bind()
row = conn.execute(f"SELECT series_provider_default_language FROM general").first()
if len(row.series_provider_default_language) == 2:
lang = babelfish.Language.fromalpha2(row.series_provider_default_language)
conn.execute(f'UPDATE general SET series_provider_default_language = "{lang.alpha3}"')
def downgrade():
pass
......@@ -22,8 +22,9 @@ def upgrade():
with op.get_context().begin_transaction():
for row in conn.execute(tv_shows.select()):
lang = babelfish.Language.fromalpha2(row.lang)
conn.execute(f'UPDATE tv_shows SET lang = "{lang.alpha3}" WHERE tv_shows.series_id = {row.series_id}')
if len(row.lang) == 2:
lang = babelfish.Language.fromalpha2(row.lang)
conn.execute(f'UPDATE tv_shows SET lang = "{lang.alpha3}" WHERE tv_shows.series_id = {row.series_id}')
def downgrade():
......
......@@ -117,7 +117,7 @@
<select name="seriesProviderLanguage" id="seriesProviderLangSelect" class="form-control"
title="${_('Choose language')}">
% for language in show.series_provider.languages():
<option value="${language['id']}" ${('', 'selected')[sickrage.app.config.general.series_provider_default_language == language['id']]}>
<option value="${language['id']}" ${('', 'selected')[show.lang == language['id']]}>
${language['name']}
</option>
% endfor
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment