mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-08 06:00:51 -07:00
Remove shadow database module name
This commit is contained in:
parent
5b5c4d1a8b
commit
2ef40a6a1c
3 changed files with 16 additions and 16 deletions
|
@ -24,14 +24,12 @@ from xml.dom import minidom
|
||||||
|
|
||||||
import plexpy
|
import plexpy
|
||||||
if plexpy.PYTHON2:
|
if plexpy.PYTHON2:
|
||||||
import activity_pinger
|
|
||||||
import activity_processor
|
import activity_processor
|
||||||
import database
|
import database
|
||||||
import helpers
|
import helpers
|
||||||
import logger
|
import logger
|
||||||
import users
|
import users
|
||||||
else:
|
else:
|
||||||
from plexpy import activity_pinger
|
|
||||||
from plexpy import activity_processor
|
from plexpy import activity_processor
|
||||||
from plexpy import database
|
from plexpy import database
|
||||||
from plexpy import helpers
|
from plexpy import helpers
|
||||||
|
@ -248,9 +246,10 @@ def extract_plexivity_xml(xml=None):
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def validate_database(database=None, table_name=None):
|
|
||||||
|
def validate_database(database_file=None, table_name=None):
|
||||||
try:
|
try:
|
||||||
connection = sqlite3.connect(database, timeout=20)
|
connection = sqlite3.connect(database_file, timeout=20)
|
||||||
except sqlite3.OperationalError:
|
except sqlite3.OperationalError:
|
||||||
logger.error("Tautulli Importer :: Invalid database specified.")
|
logger.error("Tautulli Importer :: Invalid database specified.")
|
||||||
return 'Invalid database specified.'
|
return 'Invalid database specified.'
|
||||||
|
@ -273,10 +272,11 @@ def validate_database(database=None, table_name=None):
|
||||||
|
|
||||||
return 'success'
|
return 'success'
|
||||||
|
|
||||||
def import_from_plexivity(database=None, table_name=None, import_ignore_interval=0):
|
|
||||||
|
def import_from_plexivity(database_file=None, table_name=None, import_ignore_interval=0):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = sqlite3.connect(database, timeout=20)
|
connection = sqlite3.connect(database_file, timeout=20)
|
||||||
connection.row_factory = sqlite3.Row
|
connection.row_factory = sqlite3.Row
|
||||||
except sqlite3.OperationalError:
|
except sqlite3.OperationalError:
|
||||||
logger.error("Tautulli Importer :: Invalid filename.")
|
logger.error("Tautulli Importer :: Invalid filename.")
|
||||||
|
|
|
@ -23,14 +23,12 @@ from xml.dom import minidom
|
||||||
|
|
||||||
import plexpy
|
import plexpy
|
||||||
if plexpy.PYTHON2:
|
if plexpy.PYTHON2:
|
||||||
import activity_pinger
|
|
||||||
import activity_processor
|
import activity_processor
|
||||||
import database
|
import database
|
||||||
import helpers
|
import helpers
|
||||||
import logger
|
import logger
|
||||||
import users
|
import users
|
||||||
else:
|
else:
|
||||||
from plexpy import activity_pinger
|
|
||||||
from plexpy import activity_processor
|
from plexpy import activity_processor
|
||||||
from plexpy import database
|
from plexpy import database
|
||||||
from plexpy import helpers
|
from plexpy import helpers
|
||||||
|
@ -239,9 +237,10 @@ def extract_plexwatch_xml(xml=None):
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def validate_database(database=None, table_name=None):
|
|
||||||
|
def validate_database(database_file=None, table_name=None):
|
||||||
try:
|
try:
|
||||||
connection = sqlite3.connect(database, timeout=20)
|
connection = sqlite3.connect(database_file, timeout=20)
|
||||||
except sqlite3.OperationalError:
|
except sqlite3.OperationalError:
|
||||||
logger.error("Tautulli Importer :: Invalid database specified.")
|
logger.error("Tautulli Importer :: Invalid database specified.")
|
||||||
return 'Invalid database specified.'
|
return 'Invalid database specified.'
|
||||||
|
@ -264,10 +263,11 @@ def validate_database(database=None, table_name=None):
|
||||||
|
|
||||||
return 'success'
|
return 'success'
|
||||||
|
|
||||||
def import_from_plexwatch(database=None, table_name=None, import_ignore_interval=0):
|
|
||||||
|
def import_from_plexwatch(database_file=None, table_name=None, import_ignore_interval=0):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = sqlite3.connect(database, timeout=20)
|
connection = sqlite3.connect(database_file, timeout=20)
|
||||||
connection.row_factory = sqlite3.Row
|
connection.row_factory = sqlite3.Row
|
||||||
except sqlite3.OperationalError:
|
except sqlite3.OperationalError:
|
||||||
logger.error("Tautulli Importer :: Invalid filename.")
|
logger.error("Tautulli Importer :: Invalid filename.")
|
||||||
|
|
|
@ -3802,11 +3802,11 @@ class WebInterface(object):
|
||||||
return {'result': 'error', 'message': db_check_msg}
|
return {'result': 'error', 'message': db_check_msg}
|
||||||
|
|
||||||
elif app.lower() == 'plexwatch':
|
elif app.lower() == 'plexwatch':
|
||||||
db_check_msg = plexwatch_import.validate_database(database=database_path,
|
db_check_msg = plexwatch_import.validate_database(database_file=database_path,
|
||||||
table_name=table_name)
|
table_name=table_name)
|
||||||
if db_check_msg == 'success':
|
if db_check_msg == 'success':
|
||||||
threading.Thread(target=plexwatch_import.import_from_plexwatch,
|
threading.Thread(target=plexwatch_import.import_from_plexwatch,
|
||||||
kwargs={'database': database_path,
|
kwargs={'database_file': database_path,
|
||||||
'table_name': table_name,
|
'table_name': table_name,
|
||||||
'import_ignore_interval': import_ignore_interval}).start()
|
'import_ignore_interval': import_ignore_interval}).start()
|
||||||
return {'result': 'success',
|
return {'result': 'success',
|
||||||
|
@ -3817,11 +3817,11 @@ class WebInterface(object):
|
||||||
return {'result': 'error', 'message': db_check_msg}
|
return {'result': 'error', 'message': db_check_msg}
|
||||||
|
|
||||||
elif app.lower() == 'plexivity':
|
elif app.lower() == 'plexivity':
|
||||||
db_check_msg = plexivity_import.validate_database(database=database_path,
|
db_check_msg = plexivity_import.validate_database(database_file=database_path,
|
||||||
table_name=table_name)
|
table_name=table_name)
|
||||||
if db_check_msg == 'success':
|
if db_check_msg == 'success':
|
||||||
threading.Thread(target=plexivity_import.import_from_plexivity,
|
threading.Thread(target=plexivity_import.import_from_plexivity,
|
||||||
kwargs={'database': database_path,
|
kwargs={'database_file': database_path,
|
||||||
'table_name': table_name,
|
'table_name': table_name,
|
||||||
'import_ignore_interval': import_ignore_interval}).start()
|
'import_ignore_interval': import_ignore_interval}).start()
|
||||||
return {'result': 'success',
|
return {'result': 'success',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue