From 6b94292c7e40715ccfa1244b2e5ce9e62f598715 Mon Sep 17 00:00:00 2001 From: samwiseg00 Date: Wed, 15 Aug 2018 16:31:31 -0400 Subject: [PATCH] Fix API creating a backup every sql query --- plexpy/api2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plexpy/api2.py b/plexpy/api2.py index 5f0fdec3..3b26b347 100644 --- a/plexpy/api2.py +++ b/plexpy/api2.py @@ -122,7 +122,7 @@ class API2: else: self._api_msg = 'Invalid apikey' - + if self._api_authenticated and self._api_cmd in self._api_valid_methods: self._api_msg = None self._api_kwargs = kwargs @@ -311,8 +311,8 @@ class API2: self.backup_db() else: # If the backup is less then 24 h old lets make a backup - if any([os.path.getctime(os.path.join(plexpy.CONFIG.BACKUP_DIR, file_)) < (time.time() - 86400) - and file_.endswith('.db') for file_ in os.listdir(plexpy.CONFIG.BACKUP_DIR)]): + if not any(os.path.getctime(os.path.join(plexpy.CONFIG.BACKUP_DIR, file_)) > (time.time() - 86400) + and file_.endswith('.db') for file_ in os.listdir(plexpy.CONFIG.BACKUP_DIR)): self.backup_db() db = database.MonitorDatabase()