diff --git a/qBitrr/arss.py b/qBitrr/arss.py index 806e1e3f..e7ae0f49 100755 --- a/qBitrr/arss.py +++ b/qBitrr/arss.py @@ -38,6 +38,7 @@ PROCESS_ONLY, QBIT_DISABLED, RECHECK_CATEGORY, + TAGLESS, SEARCH_LOOP_DELAY, SEARCH_ONLY, ) @@ -503,7 +504,7 @@ def __init__( self.series_file_model: SeriesFilesModel = None self.model_queue: EpisodeQueueModel | MovieQueueModel = None self.persistent_queue: FilesQueued = None - self.torrent_library: TorrentLibrary = None + self.torrents: TorrentLibrary = None self.logger.hnotice("Starting %s monitor", self._name) @property @@ -577,10 +578,10 @@ def _get_models( ]: if self.type == "sonarr": if self.series_search: - return EpisodeFilesModel, EpisodeQueueModel, SeriesFilesModel - return EpisodeFilesModel, EpisodeQueueModel, None + return EpisodeFilesModel, EpisodeQueueModel, SeriesFilesModel, TorrentLibrary if TAGLESS else None + return EpisodeFilesModel, EpisodeQueueModel, None, TorrentLibrary if TAGLESS else None elif self.type == "radarr": - return MoviesFilesModel, MovieQueueModel, None + return MoviesFilesModel, MovieQueueModel, None, TorrentLibrary if TAGLESS else None else: raise UnhandledError(f"Well you shouldn't have reached here, Arr.type={self.type}") @@ -4413,7 +4414,7 @@ def register_search_mode(self): }, ) - db1, db2, db3 = self._get_models() + db1, db2, db3, db4 = self._get_models() class Files(db1): class Meta: @@ -4439,6 +4440,28 @@ class Meta: else: self.db.create_tables([Files, Queue, PersistingQueue]) + if db4: + + self.torrent_db = SqliteDatabase(None) + self.torrent_db.init( + str(self._app_data_folder.joinpath("torrents.db")), + pragmas={ + "journal_mode": "wal", + "cache_size": -1 * 64000, # 64MB + "foreign_keys": 1, + "ignore_check_constraints": 0, + "synchronous": 0, + }, + ) + + class Torrents(db4): + class Meta: + database = self.torrent_db + + self.torrent_db.connect() + self.torrent_db.create_tables([Torrents]) + self.torrents = Torrents + self.model_file = Files self.model_queue = Queue self.persistent_queue = PersistingQueue