Add option in settings to view PMS logs, shows last 1000 lines.

Table styling fix.
This commit is contained in:
Tim 2015-07-04 00:41:37 +02:00
parent 349a850451
commit 0810584b46
9 changed files with 212 additions and 24 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, plexwatch, db, common
from plexpy import logger, notifiers, plextv, pmsconnect, plexwatch, db, common, log_reader
from plexpy.helpers import checked, radio
from mako.lookup import TemplateLookup
@ -229,6 +229,17 @@ class WebInterface(object):
'data': rows,
})
@cherrypy.expose
def get_plex_log(self, window=1000, **kwargs):
log_lines = []
try:
log_lines = {'data': log_reader.get_log_tail(window=window)}
except:
logger.warn("Unable to retrieve Plex Logs.")
cherrypy.response.headers['Content-type'] = 'application/json'
return json.dumps(log_lines)
@cherrypy.expose
def generateAPI(self):
apikey = hashlib.sha224(str(random.getrandbits(256))).hexdigest()[0:32]
@ -305,6 +316,7 @@ class WebInterface(object):
"email_smtp_port": int(plexpy.CONFIG.EMAIL_SMTP_PORT),
"email_tls": checked(plexpy.CONFIG.EMAIL_TLS),
"pms_ip": plexpy.CONFIG.PMS_IP,
"pms_logs_folder": plexpy.CONFIG.PMS_LOGS_FOLDER,
"pms_port": plexpy.CONFIG.PMS_PORT,
"pms_token": plexpy.CONFIG.PMS_TOKEN,
"pms_use_bif": checked(plexpy.CONFIG.PMS_USE_BIF),