Merge fixes

This commit is contained in:
morpheus65535 2021-12-25 10:28:08 -05:00
parent c7a8e83982
commit 3250f23720
6 changed files with 10 additions and 19 deletions

View File

@ -69,7 +69,7 @@ class ProviderEpisodes(Resource):
try:
result = manual_download_subtitle(episodePath, language, audio_language, hi, forced, subtitle,
selected_provider, providers_auth, title, 'series',
profile_id=get_profile_id(episode_id=sonarrEpisodeId))
profile_id=get_profile_id(episode_id=episodeId))
if result is not None:
message = result[0]
path = result[1]

View File

@ -70,7 +70,7 @@ class ProviderMovies(Resource):
try:
result = manual_download_subtitle(moviePath, language, audio_language, hi, forced, subtitle,
selected_provider, providers_auth, title, 'movie',
profile_id=get_profile_id(movie_id=radarrId))
profile_id=get_profile_id(movie_id=movieId))
if result is not None:
message = result[0]
path = result[1]

View File

@ -37,5 +37,4 @@ class Searches(Resource):
movies = list(movies)
search_list += movies
return jsonify(search_list)

View File

@ -48,6 +48,8 @@ class TableLanguagesProfiles(BaseModel):
items = TextField(null=False)
name = TextField(null=False)
profileId = AutoIncrementField()
mustContain = TextField(null=True)
mustNotContain = TextField(null=True)
class Meta:
table_name = 'table_languages_profiles'
@ -138,15 +140,6 @@ class TableBlacklist(BaseModel):
table_name = 'table_blacklist'
class TableLanguagesProfiles(BaseModel):
cutoff = IntegerField(null=True)
items = TextField()
name = TextField()
profileId = AutoField()
mustContain = TextField(null=True)
mustNotContain = TextField(null=True)
class TableMoviesRootfolder(BaseModel):
accessible = IntegerField(null=True)
error = TextField(null=True)
@ -302,7 +295,7 @@ def init_db():
def migrate_db():
migrate(
migrator.add_column('table_shows', 'monitored', TextField(null=True))
migrator.add_column('table_shows', 'monitored', TextField(null=True)),
migrator.add_column('table_languages_profiles', 'mustContain', TextField(null=True)),
migrator.add_column('table_languages_profiles', 'mustNotContain', TextField(null=True)),
)
@ -450,14 +443,14 @@ def get_audio_profile_languages(series_id=None, episode_id=None, movie_id=None):
def get_profile_id(series_id=None, episode_id=None, movie_id=None):
if series_id:
profileId = TableShows.get(TableShows.sonarrSeriesId == series_id).profileId
profileId = TableShows.get(TableShows.seriesId == series_id).profileId
elif episode_id:
profileId = TableShows.select(TableShows.profileId)\
.join(TableEpisodes, on=(TableShows.sonarrSeriesId == TableEpisodes.sonarrSeriesId))\
.where(TableEpisodes.sonarrEpisodeId == episode_id)\
.join(TableEpisodes)\
.where(TableEpisodes.episodeId == episode_id)\
.get().profileId
elif movie_id:
profileId = TableMovies.get(TableMovies.radarrId == movie_id).profileId
profileId = TableMovies.get(TableMovies.movieId == movie_id).profileId
else:
return None

View File

@ -330,7 +330,7 @@ def get_throttled_providers():
with open(os.path.normpath(os.path.join(args.config_dir, 'config', 'throttled_providers.dat')), 'r') as \
handle:
providers = eval(handle.read())
except:
except (OSError, ValueError, NameError, SyntaxError):
# set empty content in throttled_providers.dat
logging.error("Invalid content in throttled_providers.dat. Resetting")
set_throttled_providers(providers)

View File

@ -5,7 +5,6 @@ import sys
import ast
import logging
import subprocess
import time
import pickle
import codecs
import re