From c2417de895633b5a4e4b69f0dca3f2100099e7b7 Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 29 Aug 2015 00:18:09 +0200 Subject: [PATCH] Add "Local" as the default unauthenticated user to the local database. --- plexpy/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plexpy/__init__.py b/plexpy/__init__.py index ed0c1b5d..44cd2b3c 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -588,6 +588,12 @@ def dbcheck(): 'ALTER TABLE users ADD COLUMN custom_avatar_url TEXT' ) + # Add "Local" user to database as default unauthenticated user. + result = c_db.execute('SELECT id FROM users WHERE username = "Local"') + if not result.fetchone(): + logger.debug(u'User "Local" does not exist. Adding user.') + c_db.execute('INSERT INTO users (user_id, username) VALUES (0, "Local")') + conn_db.commit() c_db.close()