From 8f19a48d03c5f0bbf99c53720aeb95fe29fe4cb5 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Fri, 21 Apr 2023 16:20:15 -0700 Subject: [PATCH] Fix plexivity_import.py --- plexpy/plexivity_import.py | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/plexpy/plexivity_import.py b/plexpy/plexivity_import.py index 3e5350bc..644782a2 100644 --- a/plexpy/plexivity_import.py +++ b/plexpy/plexivity_import.py @@ -304,27 +304,27 @@ def import_from_plexivity(database_file=None, table_name=None, import_ignore_int logger.debug("Tautulli Importer :: Unable to refresh the users list. Aborting import.") return None - query = 'SELECT id AS id, ' \ - 'time AS started, ' \ - 'stopped, ' \ - 'null AS user_id, ' \ - 'user, ' \ - 'ip_address, ' \ - 'paused_counter, ' \ - 'platform AS player, ' \ - 'null AS platform, ' \ - 'null as machine_id, ' \ - 'null AS media_type, ' \ - 'null AS view_offset, ' \ - 'xml, ' \ - 'rating as content_rating,' \ - 'summary,' \ - 'title AS full_title,' \ - '(case when orig_title_ep = "n/a" then orig_title else ' \ - 'orig_title_ep end) as title,' \ - '(case when orig_title_ep != "n/a" then orig_title else ' \ - 'null end) as grandparent_title ' \ - 'FROM ' + table_name + ' ORDER BY id' + query = "SELECT id AS id, " \ + "time AS started, " \ + "stopped, " \ + "null AS user_id, " \ + "user, " \ + "ip_address, " \ + "paused_counter, " \ + "platform AS player, " \ + "null AS platform, " \ + "null as machine_id, " \ + "null AS media_type, " \ + "null AS view_offset, " \ + "xml, " \ + "rating as content_rating," \ + "summary," \ + "title AS full_title," \ + "(case when orig_title_ep = 'n/a' then orig_title else " \ + "orig_title_ep end) as title," \ + "(case when orig_title_ep != 'n/a' then orig_title else " \ + "null end) as grandparent_title " \ + "FROM " + table_name + " ORDER BY id" result = connection.execute(query) @@ -456,9 +456,9 @@ def import_users(): logger.debug("Tautulli Importer :: Importing Plexivity Users...") monitor_db = database.MonitorDatabase() - query = 'INSERT OR IGNORE INTO users (user_id, username) ' \ - 'SELECT user_id, user ' \ - 'FROM session_history WHERE user_id != 1 GROUP BY user_id' + query = "INSERT OR IGNORE INTO users (user_id, username) " \ + "SELECT user_id, user " \ + "FROM session_history WHERE user_id != 1 GROUP BY user_id" try: monitor_db.action(query)