mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 10:36:57 -07:00
Download config and database from the settings
This commit is contained in:
parent
7c0c7eea30
commit
84bfe99017
3 changed files with 43 additions and 5 deletions
|
@ -3630,6 +3630,37 @@ class WebInterface(object):
|
|||
return serve_file(path=fp, content_type='image/png')
|
||||
|
||||
|
||||
@cherrypy.expose
|
||||
@requireAuth(member_of("admin"))
|
||||
@addtoapi()
|
||||
def download_config(self, **kwargs):
|
||||
""" Download the PlexPy configuration file. """
|
||||
config_file = config.FILENAME
|
||||
|
||||
try:
|
||||
plexpy.CONFIG.write()
|
||||
except:
|
||||
pass
|
||||
|
||||
return serve_download(plexpy.CONFIG_FILE, name=config_file)
|
||||
|
||||
@cherrypy.expose
|
||||
@requireAuth(member_of("admin"))
|
||||
@addtoapi()
|
||||
def download_database(self, **kwargs):
|
||||
""" Download the PlexPy database file. """
|
||||
database_file = database.FILENAME
|
||||
|
||||
try:
|
||||
db = database.MonitorDatabase()
|
||||
db.connection.execute('begin immediate')
|
||||
shutil.copyfile(plexpy.DB_FILE, os.path.join(plexpy.CONFIG.CACHE_DIR, database_file))
|
||||
db.connection.rollback()
|
||||
except:
|
||||
pass
|
||||
|
||||
return serve_download(os.path.join(plexpy.CONFIG.CACHE_DIR, database_file), name=database_file)
|
||||
|
||||
@cherrypy.expose
|
||||
@requireAuth(member_of("admin"))
|
||||
@addtoapi()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue