From 1c86aa4fe3475ed400c3fa4eaddd0f1690abb652 Mon Sep 17 00:00:00 2001 From: LongHairedHacker Date: Sat, 13 Oct 2018 14:47:58 +0200 Subject: [PATCH] Fixed filenames --- update.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/update.py b/update.py index e170c2e..f873da6 100644 --- a/update.py +++ b/update.py @@ -69,10 +69,12 @@ def update_database(line): rrdtool.update(ARCHIVE_DATA_FILE, line) def update_graphs(): - for name, lines in GRAPHS.items(): + for graph_name, lines in GRAPHS.items(): # Render current data - graph_params = ['%s.png' % name, '-a', 'PNG', '-s', 'n-%d' % ARCHIVE_INTERVAL] + graph_params = ['%s.png' % graph_name, '-a', + 'PNG', '-s', 'n-%d' % ARCHIVE_INTERVAL] + for name, lable, color in lines: graph_params += ['DEF:%s=%s:%s:LAST' % (name, DATA_FILE, name)] graph_params += ['LINE1:%s%s:%s' % (name, color, lable)] @@ -80,7 +82,8 @@ def update_graphs(): rrdtool.graph(*graph_params) # Also render Archives - graph_params = ['%s_archive.png' % name, '-a', 'PNG', '-s', 'n-%d' % ARCHIVE_KEEP_INTERVAL] + graph_params = ['%s_archive.png' % graph_name, '-a', + 'PNG', '-s', 'n-%d' % ARCHIVE_KEEP_INTERVAL] for name, lable, color in lines: graph_params += ['DEF:%s=%s:%s:AVERAGE' % (name, DATA_FILE, name)] @@ -101,10 +104,11 @@ def upload_graphs(): sftp.put('%s.png' % name, 'solar/%s.png' % name) sftp.put('%s_archive.png' % name, 'solar/%s_archive.png' % name) + sftp.put('index.html', 'solar/index.html') sftp.close() transport.close() except: - print("Unexpected error uploading:", sys.exc_info()[1]) + print("Unexpected error while uploading:", sys.exc_info()[1]) def main(): pass