From 5661c004979ba0ec35bd0ddaac5a798e250d2df0 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Sun, 8 Mar 2020 11:26:13 -0700 Subject: [PATCH] Capitalize previous Windows platform in database --- plexpy/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plexpy/__init__.py b/plexpy/__init__.py index 8dbb31ae..6d407796 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -1321,6 +1321,18 @@ def dbcheck(): 'ALTER TABLE session_history ADD COLUMN relayed INTEGER' ) + # Upgrade session_history table from earlier versions + try: + result = c_db.execute('SELECT platform FROM session_history ' + 'WHERE platform = "windows"').fetchall() + if len(result) > 0: + logger.debug(u"Altering database. Capitalizing Windows platform values in session_history table.") + c_db.execute( + 'UPDATE session_history SET platform = "Windows" WHERE platform = "windows" ' + ) + except sqlite3.OperationalError: + logger.warn(u"Unable to capitalize Windows platform values in session_history table.") + # Upgrade session_history_metadata table from earlier versions try: c_db.execute('SELECT full_title FROM session_history_metadata')