mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-25 09:12:38 +00:00
Initial release of Radarr integration
This commit is contained in:
parent
757024f747
commit
337860e891
4 changed files with 17 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
bazarr_version = '0.5.0 dev'
|
||||
bazarr_version = '0.5.0'
|
||||
|
||||
import gc
|
||||
gc.enable()
|
||||
|
|
|
@ -3,6 +3,7 @@ import sqlite3
|
|||
import requests
|
||||
|
||||
from get_general_settings import *
|
||||
from list_subtitles import *
|
||||
|
||||
def update_movies():
|
||||
from get_radarr_settings import get_radarr_settings
|
||||
|
@ -64,16 +65,21 @@ def update_movies():
|
|||
except:
|
||||
c.execute('''UPDATE table_movies SET title = ?, path = ?, tmdbId = ?, radarrId = ?, overview = ?, poster = ?, fanart = ?, `audio_language` = ?, sceneName = ? WHERE tmdbid = ?''', (movie["title"],movie["path"] + separator + movie['movieFile']['relativePath'],movie["tmdbId"],movie["id"],overview,poster,fanart,profile_id_to_language(movie['qualityProfileId']),sceneName,movie["tmdbId"]))
|
||||
|
||||
# Delete movies not in radarr anymore
|
||||
deleted_items = []
|
||||
for item in current_movies_db_list:
|
||||
if item not in current_movies_radarr:
|
||||
deleted_items.append(tuple([item]))
|
||||
c.executemany('DELETE FROM table_movies WHERE tmdbId = ?',deleted_items)
|
||||
|
||||
# Commit changes to database table
|
||||
db.commit()
|
||||
|
||||
# Delete movies not in radarr anymore
|
||||
added_movies = list(set(current_movies_radarr) - set(current_movies_db_list))
|
||||
removed_movies = list(set(current_movies_db_list) - set(current_movies_radarr))
|
||||
|
||||
for removed_movie in removed_movies:
|
||||
c.execute('DELETE FROM table_movies WHERE radarrId = ?', (removed_movie,))
|
||||
db.commit()
|
||||
|
||||
for added_movie in added_movies:
|
||||
added_path = c.execute('SELECT path FROM table_movies WHERE tmdbId = ?', (added_movie,)).fetchone()
|
||||
store_subtitles_movie(path_replace(added_path[0]))
|
||||
|
||||
# Close database connection
|
||||
db.close()
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ if integration[12] == "True":
|
|||
scheduler.add_job(sync_episodes, 'interval', minutes=5, max_instances=1, coalesce=True, misfire_grace_time=15, id='sync_episodes', name='Sync episodes with Sonarr')
|
||||
|
||||
if integration[13] == "True":
|
||||
scheduler.add_job(update_movies, 'interval', minutes=1, max_instances=1, coalesce=True, misfire_grace_time=15, id='update_movies', name='Update movies list from Radarr')
|
||||
scheduler.add_job(update_movies, 'interval', minutes=5, max_instances=1, coalesce=True, misfire_grace_time=15, id='update_movies', name='Update movies list from Radarr')
|
||||
|
||||
if integration[12] == "True" or integration[13] == "True":
|
||||
scheduler.add_job(wanted_search_missing_subtitles, 'interval', hours=3, max_instances=1, coalesce=True, misfire_grace_time=15, id='wanted_search_missing_subtitles', name='Search for wanted subtitles')
|
||||
|
|
|
@ -92,7 +92,7 @@ if os.path.exists(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
|
|||
except:
|
||||
pass
|
||||
else:
|
||||
c.execute('INSERT INTO `table_settings_radarr` (ip, port, base_url, ssl, apikey, full_update) VALUES ("0.0.0.0", "7878", "/", "False", Null, "Daily")')
|
||||
c.execute('INSERT INTO `table_settings_radarr` (ip, port, base_url, ssl, apikey, full_update) VALUES ("127.0.0.1", "7878", "/", "False", Null, "Daily")')
|
||||
|
||||
try:
|
||||
c.execute('CREATE TABLE "table_movies" ( `tmdbId` TEXT NOT NULL UNIQUE, `title` TEXT NOT NULL, `path` TEXT NOT NULL UNIQUE, `languages` TEXT, `subtitles` TEXT, `missing_subtitles` TEXT, `hearing_impaired` TEXT, `radarrId` INTEGER NOT NULL UNIQUE, `overview` TEXT, `poster` TEXT, `fanart` TEXT, "audio_language" "text", `sceneName` TEXT, PRIMARY KEY(`tmdbId`) )')
|
||||
|
|
Loading…
Reference in a new issue