add bulletin board rss, correct spelling of bulletin
This commit is contained in:
parent
40a3030694
commit
ec82ce8b24
@ -177,7 +177,7 @@ def dashboard_bb_write(call, dmr_id, time, bulletin):
|
||||
dash_bb = ast.literal_eval(os.popen('cat /tmp/gps_data_user_bb.txt').read())
|
||||
# except:
|
||||
# dash_entries = []
|
||||
dash_bb.insert(0, {'call': call, 'dmr_id': dmr_id, 'time': time, 'bulliten':bulletin})
|
||||
dash_bb.insert(0, {'call': call, 'dmr_id': dmr_id, 'time': time, 'bulletin':bulletin})
|
||||
with open("/tmp/gps_data_user_bb.txt", 'w') as user_bb_file:
|
||||
user_bb_file.write(str(dash_bb[:10]))
|
||||
user_bb_file.close()
|
||||
|
@ -170,7 +170,7 @@ def dashboard_bb_write(call, dmr_id, time, bulletin):
|
||||
dash_bb = ast.literal_eval(os.popen('cat /tmp/gps_data_user_bb.txt').read())
|
||||
# except:
|
||||
# dash_entries = []
|
||||
dash_bb.insert(0, {'call': call, 'dmr_id': dmr_id, 'time': time, 'bulliten':bulletin})
|
||||
dash_bb.insert(0, {'call': call, 'dmr_id': dmr_id, 'time': time, 'bulletin':bulletin})
|
||||
with open("/tmp/gps_data_user_bb.txt", 'w') as user_bb_file:
|
||||
user_bb_file.write(str(dash_bb[:10]))
|
||||
user_bb_file.close()
|
||||
|
@ -21,7 +21,7 @@
|
||||
This is a web dashboard for the GPS/Data application.
|
||||
'''
|
||||
|
||||
from flask import Flask, render_template, request
|
||||
from flask import Flask, render_template, request, Response
|
||||
import ast, os
|
||||
from dashboard_settings import *
|
||||
import folium
|
||||
@ -107,7 +107,7 @@ def get_bb_data():
|
||||
tmp_bb = tmp_bb + '''<tr>
|
||||
<td style="text-align: center;"><strong> ''' + e['call'] + ''' </strong></td>
|
||||
<td style="text-align: center;">''' + str(e['dmr_id']) + '''</td>
|
||||
<td style="text-align: center;"><strong> ''' + e['bulliten'] + ''' </strong></td>
|
||||
<td style="text-align: center;"><strong> ''' + e['bulletin'] + ''' </strong></td>
|
||||
<td style="text-align: center;"> ''' + e['time'] + ''' </td>
|
||||
</tr>'''
|
||||
|
||||
@ -265,5 +265,25 @@ def view_map():
|
||||
def map():
|
||||
return render_template('map.html', title = dashboard_title, logo = logo)
|
||||
|
||||
@app.route('/bulletin_rss.xml')
|
||||
def bb_rss():
|
||||
#return render_template('map.html', title = dashboard_title, logo = logo)
|
||||
dash_bb = ast.literal_eval(os.popen('cat /tmp/gps_data_user_bb.txt').read())
|
||||
post_data = ''
|
||||
rss_header = """<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>""" + dashboard_title + """ - Bulletin Board Feed</title>
|
||||
<link>""" + rss_link + """</link>
|
||||
<description>This is the Bulletin Board feed from """ + dashboard_title + """</description>"""
|
||||
for entry in dash_bb:
|
||||
post_data = post_data + """
|
||||
<item>
|
||||
<title>""" + entry['call'] + ' - ' + str(entry['dmr_id']) + """</title>
|
||||
<link>""" + rss_link + """</link>
|
||||
<description>""" + entry['bulletin'] + """ - """ + entry['time'] + """</description>
|
||||
</item>
|
||||
"""
|
||||
return Response(rss_header + post_data + "</channel>\n</rss>", mimetype='text/xml')
|
||||
if __name__ == '__main__':
|
||||
app.run(debug = True, port=dash_port, host=dash_host)
|
||||
|
@ -52,3 +52,6 @@ contact_website = 'https://hbl.ink'
|
||||
map_center = (47.00, -120.00)
|
||||
zoom_level = 7
|
||||
|
||||
# RSS feed link, shows in the link section of each RSS item.
|
||||
rss_link = 'http://localhost:8092'
|
||||
|
||||
|
@ -23,6 +23,7 @@ p {
|
||||
<body>
|
||||
{% include 'header.html' %}
|
||||
<p style="text-align: center;"><em>Page automatically reloads every 2 minutes.</em></p>
|
||||
<h4 style="text-align: center;"><a href="bulletin_rss.xml"><em>Bulletin Board RSS Feed</em></a><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5QIcFBAOXAevLAAAAZZJREFUSMftlbtKA0EUhj8jWhi8gaIEC29oxEoRFESLgIXYiWVSKoj6CCrBBwj6CBHNE1hEWy21ETQqiIW1wXhPo81ZOBw2apbdVPvDsDPnP8M/5zKzECJEQKivYO8DFoAYEAGKtTpQEvhW4w3IA+tAVy2F9fgEskA8COHUL8LOKAMZoMmLQF0FewcwImmNAzPANBB18b0BFoGroNLfBiyLgI2+BMwF3XgNwCrwYsQ//BBPSRPdAoeybjE+A8ClS+Sjfnf1E5A2dW4FzoxfwWvD/XWd7oAxI24jz3gVnpS7eiEpt+KvQEL5D5qal/245zFgU+pnXzMd+Zrh9/3q5l7g3CXtTs0bgWvFffn5vDa7iKcVv2K4DS8i3cAOsAuMm8h12ovqqrVL/R3upFrRKPBgHgctvm0iSynuWNnf5bf6byy5dPKe4nukhg6XU9yW2TfsJlDpNCUX27OaP8pD4WBCzQtmX381EUeAI3Xqe6m5xoHpYAezJuJkNb9Fh0tI4+SlXhpTwJBaZ+XbCcwr+6kcPESI2uAHmAijFaMnEmYAAAAASUVORK5CYII=" /></h4>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
|
Loading…
Reference in New Issue
Block a user