From eddcc7f56661d60fc8f509705e0a457cbd727d31 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Fri, 21 Apr 2023 16:09:45 -0700 Subject: [PATCH] Fix mobile_app.py --- plexpy/mobile_app.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plexpy/mobile_app.py b/plexpy/mobile_app.py index 458f84a0..57734975 100644 --- a/plexpy/mobile_app.py +++ b/plexpy/mobile_app.py @@ -67,17 +67,17 @@ def get_mobile_devices(device_id=None, device_token=None): args = [] if device_id or device_token: - where = 'WHERE ' + where = "WHERE " if device_id: - where_id += 'device_id = ?' + where_id += "device_id = ?" args.append(device_id) if device_token: - where_token = 'device_token = ?' + where_token = "device_token = ?" args.append(device_token) - where += ' AND '.join([w for w in [where_id, where_token] if w]) + where += " AND ".join([w for w in [where_id, where_token] if w]) db = database.MonitorDatabase() - result = db.select('SELECT * FROM mobile_devices %s' % where, args=args) + result = db.select("SELECT * FROM mobile_devices %s" % where, args=args) return result @@ -128,7 +128,7 @@ def get_mobile_device_config(mobile_device_id=None): return None db = database.MonitorDatabase() - result = db.select_single('SELECT * FROM mobile_devices WHERE id = ?', + result = db.select_single("SELECT * FROM mobile_devices WHERE id = ?", args=[mobile_device_id]) if result['onesignal_id'] == _ONESIGNAL_DISABLED: @@ -163,11 +163,11 @@ def delete_mobile_device(mobile_device_id=None, device_id=None): if mobile_device_id: logger.debug("Tautulli MobileApp :: Deleting mobile_device_id %s from the database." % mobile_device_id) - result = db.action('DELETE FROM mobile_devices WHERE id = ?', args=[mobile_device_id]) + result = db.action("DELETE FROM mobile_devices WHERE id = ?", args=[mobile_device_id]) return True elif device_id: logger.debug("Tautulli MobileApp :: Deleting device_id %s from the database." % device_id) - result = db.action('DELETE FROM mobile_devices WHERE device_id = ?', args=[device_id]) + result = db.action("DELETE FROM mobile_devices WHERE device_id = ?", args=[device_id]) return True else: return False @@ -179,9 +179,9 @@ def set_official(device_id, onesignal_id): platform = 'android' if official > 0 else None try: - result = db.action('UPDATE mobile_devices ' - 'SET official = ?, platform = coalesce(platform, ?) ' - 'WHERE device_id = ?', + result = db.action("UPDATE mobile_devices " + "SET official = ?, platform = coalesce(platform, ?) " + "WHERE device_id = ?", args=[official, platform, device_id]) except Exception as e: logger.warn("Tautulli MobileApp :: Failed to set official flag for device: %s." % e) @@ -193,7 +193,7 @@ def set_last_seen(device_token=None): last_seen = helpers.timestamp() try: - result = db.action('UPDATE mobile_devices SET last_seen = ? WHERE device_token = ?', + result = db.action("UPDATE mobile_devices SET last_seen = ? WHERE device_token = ?", args=[last_seen, device_token]) except Exception as e: logger.warn("Tautulli MobileApp :: Failed to set last_seen time for device: %s." % e)