mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 23:42:37 -07:00
Add database import in progress message
This commit is contained in:
parent
2ef40a6a1c
commit
fbcf59abf0
6 changed files with 35 additions and 7 deletions
|
@ -8,6 +8,13 @@
|
||||||
|
|
||||||
<%def name="body()">
|
<%def name="body()">
|
||||||
<div class='container-fluid'>
|
<div class='container-fluid'>
|
||||||
|
% if config['database_is_importing']:
|
||||||
|
<div style="text-align: center; margin-top: 20px;">
|
||||||
|
<i class="fa fa-refresh fa-spin"></i> Tautulli is importing history from another database. This could take a few minutes depending on the size of your database.
|
||||||
|
<br />
|
||||||
|
You may leave this page and check back later.
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
<div class='table-card-header'>
|
<div class='table-card-header'>
|
||||||
<div class="header-bar">
|
<div class="header-bar">
|
||||||
<span><i class="fa fa-history"></i> History</span>
|
<span><i class="fa fa-history"></i> History</span>
|
||||||
|
|
|
@ -251,9 +251,9 @@ DOCUMENTATION :: END
|
||||||
% else:
|
% else:
|
||||||
<div id="get_file_sizes_message" style="text-align: center; margin-top: 20px; display: none;">
|
<div id="get_file_sizes_message" style="text-align: center; margin-top: 20px; display: none;">
|
||||||
% endif
|
% endif
|
||||||
<i class="fa fa-refresh fa-spin"></i> Tautulli is calculating the file sizes for the library's media info. This could take a few minutes depending on the size of your library.
|
<i class="fa fa-refresh fa-spin"></i> Tautulli is calculating the file sizes for the library's media info. This could take a few minutes depending on the size of your library.
|
||||||
<br />
|
<br />
|
||||||
You may leave this page and come back later.
|
You may leave this page and check back later.
|
||||||
</div>
|
</div>
|
||||||
<div class='table-card-header'>
|
<div class='table-card-header'>
|
||||||
<div class="header-bar">
|
<div class="header-bar">
|
||||||
|
|
|
@ -27,15 +27,22 @@ import time
|
||||||
import plexpy
|
import plexpy
|
||||||
if plexpy.PYTHON2:
|
if plexpy.PYTHON2:
|
||||||
import logger
|
import logger
|
||||||
from helpers import cast_to_int
|
from helpers import cast_to_int, bool_true
|
||||||
else:
|
else:
|
||||||
from plexpy import logger
|
from plexpy import logger
|
||||||
from plexpy.helpers import cast_to_int
|
from plexpy.helpers import cast_to_int, bool_true
|
||||||
|
|
||||||
|
|
||||||
FILENAME = "tautulli.db"
|
FILENAME = "tautulli.db"
|
||||||
db_lock = threading.Lock()
|
db_lock = threading.Lock()
|
||||||
|
|
||||||
|
IS_IMPORTING = False
|
||||||
|
|
||||||
|
|
||||||
|
def set_is_importing(value):
|
||||||
|
global IS_IMPORTING
|
||||||
|
IS_IMPORTING = bool_true(value)
|
||||||
|
|
||||||
|
|
||||||
def validate_database(database=None):
|
def validate_database(database=None):
|
||||||
try:
|
try:
|
||||||
|
@ -78,6 +85,7 @@ def import_tautulli_db(database=None, method=None, backup=False):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.info("Tautulli Database :: Importing Tautulli database '%s' with import method '%s'...", database, method)
|
logger.info("Tautulli Database :: Importing Tautulli database '%s' with import method '%s'...", database, method)
|
||||||
|
set_is_importing(True)
|
||||||
|
|
||||||
db = MonitorDatabase()
|
db = MonitorDatabase()
|
||||||
db.connection.execute('BEGIN IMMEDIATE')
|
db.connection.execute('BEGIN IMMEDIATE')
|
||||||
|
@ -171,6 +179,7 @@ def import_tautulli_db(database=None, method=None, backup=False):
|
||||||
db.action('VACUUM')
|
db.action('VACUUM')
|
||||||
|
|
||||||
logger.info("Tautulli Database :: Tautulli database import complete.")
|
logger.info("Tautulli Database :: Tautulli database import complete.")
|
||||||
|
set_is_importing(False)
|
||||||
|
|
||||||
|
|
||||||
def integrity_check():
|
def integrity_check():
|
||||||
|
|
|
@ -292,6 +292,7 @@ def import_from_plexivity(database_file=None, table_name=None, import_ignore_int
|
||||||
return None
|
return None
|
||||||
|
|
||||||
logger.debug("Tautulli Importer :: Plexivity data import in progress...")
|
logger.debug("Tautulli Importer :: Plexivity data import in progress...")
|
||||||
|
database.set_is_importing(True)
|
||||||
|
|
||||||
ap = activity_processor.ActivityProcessor()
|
ap = activity_processor.ActivityProcessor()
|
||||||
user_data = users.Users()
|
user_data = users.Users()
|
||||||
|
@ -445,9 +446,12 @@ def import_from_plexivity(database_file=None, table_name=None, import_ignore_int
|
||||||
else:
|
else:
|
||||||
logger.debug("Tautulli Importer :: Item has bad rating_key: %s" % session_history_metadata['rating_key'])
|
logger.debug("Tautulli Importer :: Item has bad rating_key: %s" % session_history_metadata['rating_key'])
|
||||||
|
|
||||||
logger.debug("Tautulli Importer :: Plexivity data import complete.")
|
|
||||||
import_users()
|
import_users()
|
||||||
|
|
||||||
|
logger.debug("Tautulli Importer :: Plexivity data import complete.")
|
||||||
|
database.set_is_importing(False)
|
||||||
|
|
||||||
|
|
||||||
def import_users():
|
def import_users():
|
||||||
logger.debug("Tautulli Importer :: Importing Plexivity Users...")
|
logger.debug("Tautulli Importer :: Importing Plexivity Users...")
|
||||||
monitor_db = database.MonitorDatabase()
|
monitor_db = database.MonitorDatabase()
|
||||||
|
|
|
@ -283,6 +283,7 @@ def import_from_plexwatch(database_file=None, table_name=None, import_ignore_int
|
||||||
return None
|
return None
|
||||||
|
|
||||||
logger.debug("Tautulli Importer :: PlexWatch data import in progress...")
|
logger.debug("Tautulli Importer :: PlexWatch data import in progress...")
|
||||||
|
database.set_is_importing(True)
|
||||||
|
|
||||||
ap = activity_processor.ActivityProcessor()
|
ap = activity_processor.ActivityProcessor()
|
||||||
user_data = users.Users()
|
user_data = users.Users()
|
||||||
|
@ -438,9 +439,12 @@ def import_from_plexwatch(database_file=None, table_name=None, import_ignore_int
|
||||||
else:
|
else:
|
||||||
logger.debug("Tautulli Importer :: Item has bad rating_key: %s" % session_history_metadata['rating_key'])
|
logger.debug("Tautulli Importer :: Item has bad rating_key: %s" % session_history_metadata['rating_key'])
|
||||||
|
|
||||||
logger.debug("Tautulli Importer :: PlexWatch data import complete.")
|
|
||||||
import_users()
|
import_users()
|
||||||
|
|
||||||
|
logger.debug("Tautulli Importer :: PlexWatch data import complete.")
|
||||||
|
database.set_is_importing(False)
|
||||||
|
|
||||||
|
|
||||||
def import_users():
|
def import_users():
|
||||||
logger.debug("Tautulli Importer :: Importing PlexWatch Users...")
|
logger.debug("Tautulli Importer :: Importing PlexWatch Users...")
|
||||||
monitor_db = database.MonitorDatabase()
|
monitor_db = database.MonitorDatabase()
|
||||||
|
|
|
@ -1720,7 +1720,11 @@ class WebInterface(object):
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@requireAuth()
|
@requireAuth()
|
||||||
def history(self, **kwargs):
|
def history(self, **kwargs):
|
||||||
return serve_template(templatename="history.html", title="History")
|
config = {
|
||||||
|
"database_is_importing": database.IS_IMPORTING,
|
||||||
|
}
|
||||||
|
|
||||||
|
return serve_template(templatename="history.html", title="History", config=config)
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue