mirror of
https://github.com/morpheus65535/bazarr
synced 2025-02-23 14:31:06 +00:00
Removal of history reverse engineering.
This commit is contained in:
parent
81d1015e7e
commit
53c6d9e329
2 changed files with 0 additions and 48 deletions
|
@ -124,46 +124,3 @@ def force_unicode(s):
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
s = UnicodeDammit(s).unicode_markup
|
s = UnicodeDammit(s).unicode_markup
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
def upgrade_history():
|
|
||||||
# Open database connection
|
|
||||||
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
|
||||||
c = db.cursor()
|
|
||||||
|
|
||||||
data = c.execute('SELECT sonarrEpisodeId, video_path, description, ROWID FROM table_history WHERE action = 1').fetchall()
|
|
||||||
|
|
||||||
for row in data:
|
|
||||||
if row[1] is None:
|
|
||||||
path = c.execute('SELECT path FROM table_episodes WHERE sonarrEpisodeId = ?', (row[0],)).fetchone()
|
|
||||||
if path is not None:
|
|
||||||
c.execute('UPDATE table_history SET video_path = ? WHERE sonarrEpisodeId = ?', (path[0], row[0]))
|
|
||||||
|
|
||||||
values = re.split(r' subtitles downloaded from | with a score of | using', row[2])[:-1]
|
|
||||||
language = alpha2_from_language(values[0])
|
|
||||||
provider = values[1]
|
|
||||||
score = int(round((float(values[2][:-1])/100 * 360) - 0.5))
|
|
||||||
c.execute('UPDATE table_history SET language = ?, provider = ?, score = ? WHERE ROWID = ?', (language, provider, score, row[3]))
|
|
||||||
db.commit()
|
|
||||||
db.close()
|
|
||||||
|
|
||||||
def upgrade_history_movies():
|
|
||||||
# Open database connection
|
|
||||||
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
|
||||||
c = db.cursor()
|
|
||||||
|
|
||||||
data = c.execute('SELECT radarrId, video_path, description, ROWID FROM table_history_movie WHERE action = 1').fetchall()
|
|
||||||
|
|
||||||
for row in data:
|
|
||||||
if row[1] is None:
|
|
||||||
path = c.execute('SELECT path FROM table_movies WHERE radarrId = ?', (row[0],)).fetchone()
|
|
||||||
if path is not None:
|
|
||||||
c.execute('UPDATE table_history_movie SET video_path = ? WHERE radarrId = ?', (path[0], row[0]))
|
|
||||||
|
|
||||||
values = re.split(r' subtitles downloaded from | with a score of | using', row[2])[:-1]
|
|
||||||
language = alpha2_from_language(values[0])
|
|
||||||
provider = values[1]
|
|
||||||
score = int(round((float(values[2][:-1]) / 100 * 120) - 0.5))
|
|
||||||
c.execute('UPDATE table_history_movie SET language = ?, provider = ?, score = ? WHERE ROWID = ?', (language, provider, score, row[3]))
|
|
||||||
db.commit()
|
|
||||||
db.close()
|
|
||||||
|
|
|
@ -137,10 +137,5 @@ if os.path.exists(os.path.join(args.config_dir, 'db', 'bazarr.db')):
|
||||||
db.commit()
|
db.commit()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
else:
|
|
||||||
if settings.general.getboolean('use_sonarr'):
|
|
||||||
upgrade_history()
|
|
||||||
if settings.general.getboolean('use_radarr'):
|
|
||||||
upgrade_history_movies()
|
|
||||||
|
|
||||||
db.close()
|
db.close()
|
||||||
|
|
Loading…
Reference in a new issue