mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Add button to regroup play history
This commit is contained in:
parent
1fe6d1505f
commit
b144e6527f
3 changed files with 49 additions and 8 deletions
|
@ -709,7 +709,8 @@ class ActivityProcessor(object):
|
|||
|
||||
def regroup_history(self):
|
||||
logger.info("Tautulli ActivityProcessor :: Creating database backup...")
|
||||
database.make_backup()
|
||||
if not database.make_backup():
|
||||
return False
|
||||
|
||||
logger.info("Tautulli ActivityProcessor :: Regrouping session history...")
|
||||
|
||||
|
@ -720,6 +721,11 @@ class ActivityProcessor(object):
|
|||
results = self.db.select(query)
|
||||
|
||||
for session in results:
|
||||
self.group_history(session['id'], session)
|
||||
try:
|
||||
self.group_history(session['id'], session)
|
||||
except Exception as e:
|
||||
logger.error("Tautulli ActivityProcessor :: Error regrouping session history: %s", e)
|
||||
return False
|
||||
|
||||
logger.info("Tautulli ActivityProcessor :: Regrouping session history complete.")
|
||||
return True
|
||||
|
|
|
@ -51,6 +51,7 @@ if sys.version_info >= (3, 6):
|
|||
import plexpy
|
||||
if plexpy.PYTHON2:
|
||||
import activity_pinger
|
||||
import activity_processor
|
||||
import common
|
||||
import config
|
||||
import database
|
||||
|
@ -85,6 +86,7 @@ if plexpy.PYTHON2:
|
|||
import macos
|
||||
else:
|
||||
from plexpy import activity_pinger
|
||||
from plexpy import activity_processor
|
||||
from plexpy import common
|
||||
from plexpy import config
|
||||
from plexpy import database
|
||||
|
@ -434,6 +436,20 @@ class WebInterface(object):
|
|||
logger.warn("Unable to retrieve data for get_recently_added.")
|
||||
return serve_template(template_name="recently_added.html", data=None)
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
@addtoapi()
|
||||
def regroup_history(self, **kwargs):
|
||||
""" Regroup play history in the database."""
|
||||
|
||||
result = activity_processor.ActivityProcessor().regroup_history()
|
||||
|
||||
if result:
|
||||
return {'result': 'success', 'message': 'Regrouped play history.'}
|
||||
else:
|
||||
return {'result': 'error', 'message': 'Regrouping play history failed.'}
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue