diff --git a/web/app.py b/web/app.py index fa7a11e..5372a7a 100644 --- a/web/app.py +++ b/web/app.py @@ -2361,6 +2361,29 @@ TG #: ''' + str(tg_d.tg) + ''' ''' return render_template('sms.html', markup_content = Markup(content)) + @app.route('/bulletin_rss.xml') + def rss_bb(): + rss_header = """ + + + """ + title + """ - Bulletin Board Feed + """ + url + """/bb + This is a feed of all posts from the Bulletin Board.""" + bbl = BulletinBoard.query.order_by(BulletinBoard.time.desc()).all() + bb_content = ''' ''' + for i in bbl: + bb_content = bb_content + """ + + """ + i.callsign + ' - ' + str(i.dmr_id) + """ + """ + url + """/bb + """ + i.bulletin + """ - """ + str(i.time.strftime(time_format)) + """ + """ + i.time.strftime('%a, %d %b %y') +""" + + +""" + + return Response(rss_header + bb_content + "\n\n", mimetype='text/xml') + @app.route('/bb') def all_bb(): bbl = BulletinBoard.query.order_by(BulletinBoard.time.desc()).all() @@ -2396,12 +2419,33 @@ TG #: ''' + str(tg_d.tg) + ''' print(content) return render_template('ss_all.html', markup_content = Markup(content)) + @app.route('/ss/.xml') + def get_ss_rss(dmr_id): + rss_header = """ + + + """ + title + """ - Social Status Feed for """ + str(dmr_id) + """ + """ + url + """/ss/""" + dmr_id + """ + This is a feed of all posts from """ + dmr_id + """""" + ss_all = Social.query.filter_by(dmr_id=dmr_id).order_by(Social.time.desc()).all() + ss_content = '' + for i in ss_all: + ss_content = ss_content + """ + + """ + str(dmr_id) + ' - ' + str(i.time.strftime(time_format)) + """ + """ + url + """/ss/""" + dmr_id + """ + """ + str(i.message) + """ - """ + str(i.time.strftime(time_format)) + """ + """ + str(i.time.strftime('%a, %d %b %y')) + """ + +""" + + return Response(rss_header + ss_content + "\n\n", mimetype='text/xml') + @app.route('/ss/') def get_ss(dmr_id): try: ssd = Social.query.filter_by(dmr_id=dmr_id).order_by(Social.time.desc()).first() ss_all = Social.query.filter_by(dmr_id=dmr_id).order_by(Social.time.desc()).all() - print(ss_all) post_content = '' content = '''
@@ -2420,7 +2464,8 @@ TG #: ''' + str(tg_d.tg) + ''' except: content = '

No posts by user.

' all_post = '' - return render_template('ss.html', markup_content = Markup(content), all_post = Markup(post_content)) + return render_template('ss.html', markup_content = Markup(content), all_post = Markup(post_content), user_id = dmr_id) + @app.route('/talkgroups/') #, methods=['POST', 'GET']) @login_required diff --git a/web/templates/bb.html b/web/templates/bb.html index e4b5ea9..ece7b55 100644 --- a/web/templates/bb.html +++ b/web/templates/bb.html @@ -2,6 +2,8 @@ {% block content %}

Bulletin Board

+

Bulletin Board RSS Feed

+
diff --git a/web/templates/ss.html b/web/templates/ss.html index 3f076e8..b39cda5 100644 --- a/web/templates/ss.html +++ b/web/templates/ss.html @@ -2,6 +2,8 @@ {% block content %}

Social Status

+

RSS Feed

+