Add libraries page

This commit is contained in:
Jonathan Wong 2015-12-07 23:41:53 -08:00
parent 8ba68dcfcf
commit a5b0837cf5
7 changed files with 1016 additions and 9 deletions

View file

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
from plexpy import logger, notifiers, plextv, pmsconnect, common, log_reader, datafactory, graphs, users, helpers
from plexpy import logger, notifiers, plextv, pmsconnect, common, log_reader, datafactory, graphs, users, libraries
from plexpy.helpers import checked, radio
from mako.lookup import TemplateLookup
@ -167,6 +167,10 @@ class WebInterface(object):
def users(self):
return serve_template(templatename="users.html", title="Users")
@cherrypy.expose
def libraries(self):
return serve_template(templatename="libraries.html", title="Libraries")
@cherrypy.expose
def graphs(self):
@ -262,6 +266,26 @@ class WebInterface(object):
status_message = "Failed to update user."
return status_message
@cherrypy.expose
def edit_library(self, section_id=None, **kwargs):
do_notify = kwargs.get('do_notify', 0)
keep_history = kwargs.get('keep_history', 0)
custom_thumb = kwargs.get('custom_thumb', '')
library_data = libraries.Libraries()
if section_id:
try:
library_data.set_library_config(section_id=section_id,
do_notify=do_notify,
keep_history=keep_history,
custom_thumb=custom_thumb)
status_message = "Successfully updated library."
return status_message
except:
status_message = "Failed to update library."
return status_message
@cherrypy.expose
def get_stream_data(self, row_id=None, user=None, **kwargs):
@ -290,6 +314,15 @@ class WebInterface(object):
cherrypy.response.headers['Content-type'] = 'application/json'
return json.dumps(user_list)
@cherrypy.expose
def get_library_list(self, **kwargs):
library_data = libraries.Libraries()
library_list = library_data.get_library_list(kwargs=kwargs)
cherrypy.response.headers['Content-type'] = 'application/json'
return json.dumps(library_list)
@cherrypy.expose
def checkGithub(self):
from plexpy import versioncheck
@ -1560,6 +1593,20 @@ class WebInterface(object):
cherrypy.response.headers['Content-type'] = 'application/json'
return json.dumps({'message': 'no data received'})
@cherrypy.expose
def delete_all_library_history(self, library_id, **kwargs):
library_data = libraries.Libraries()
if library_id:
delete_row = library_data.delete_all_library_history(library_id=library_id)
if delete_row:
cherrypy.response.headers['Content-type'] = 'application/json'
return json.dumps({'message': delete_row})
else:
cherrypy.response.headers['Content-type'] = 'application/json'
return json.dumps({'message': 'no data received'})
@cherrypy.expose
def search(self, query=''):