Browse Source

adding the APPLICATION_HOSTNAME to .env + settings.py for now, adding parsing function to list audio files in podcast view, changing order of buttons in nav

technodisobedience
mb 1 year ago
parent
commit
5520464845
  1. 11
      octomode.py
  2. 1
      settings.py
  3. 6
      templates/base.html
  4. 15
      templates/podcast.rss

11
octomode.py

@ -131,8 +131,7 @@ def get_app_hostname():
# app_url = urlparse(request.base_url).netloc # app_url = urlparse(request.base_url).netloc
# app_hostname = app_protocol + app_url # app_hostname = app_protocol + app_url
# app_hostname = "http://localhost:5555" # hardcoded for now app_hostname = APP.config['APPLICATION_HOSTNAME']
app_hostname = "https://circulations.constantvzw.org" # hardcoded for now
return app_hostname return app_hostname
@ -246,9 +245,13 @@ def pagedjs(name):
def rss(name): def rss(name):
# TO GENERATE THE PODCAST RSS FEED # TO GENERATE THE PODCAST RSS FEED
md_pad_content = get_pad_content(name, ext='.md') md_pad_content = get_pad_content(name, ext='.md')
rss = "RSS FEED TO BE INSERTED HERE" audio = []
for line in md_pad_content.splitlines():
# if any(ext in line for ext in [".mp3", ".ogg"]):
if ".mp3" in line:
audio.append(line)
return render_template('podcast.rss', name=name.strip(), rss=rss) return render_template('podcast.rss', name=name.strip(), rss=rss, audio=audio)
# ////////////////// # //////////////////

1
settings.py

@ -5,6 +5,7 @@ from dotenv import load_dotenv
load_dotenv() load_dotenv()
# Bind them to Python variables # Bind them to Python variables
APPLICATION_HOSTNAME = os.environ.get('OCTOMODE_APPLICATION_HOSTNAME', 'http://localhost:5555')
APPLICATION_ROOT = os.environ.get('OCTOMODE_APPLICATION_ROOT', '/') APPLICATION_ROOT = os.environ.get('OCTOMODE_APPLICATION_ROOT', '/')
PORTNUMBER = int(os.environ.get('OCTOMODE_PORTNUMBER', 5001)) PORTNUMBER = int(os.environ.get('OCTOMODE_PORTNUMBER', 5001))
PAD_URL = os.environ.get('OCTOMODE_PAD_URL', 'https://pad.vvvvvvaria.org') PAD_URL = os.environ.get('OCTOMODE_PAD_URL', 'https://pad.vvvvvvaria.org')

6
templates/base.html

@ -36,12 +36,12 @@ window.addEventListener('load', function () {
<a href="{{ url_for('html', name=name) }}"><button>html</button></a> <a href="{{ url_for('html', name=name) }}"><button>html</button></a>
<a class="link" href="{{ url_for('preview', name=name) }}" target="_blank">🔗</a> <a class="link" href="{{ url_for('preview', name=name) }}" target="_blank">🔗</a>
<a href="{{ url_for('pdf', name=name) }}"><button>pdf</button></a>
<a class="link" href="{{ url_for('pagedjs', name=name) }}" target="_blank">🔗</a>
<a href="{{ url_for('podcast', name=name) }}"><button>podcast</button></a> <a href="{{ url_for('podcast', name=name) }}"><button>podcast</button></a>
<a class="link" href="{{ url_for('rss', name=name) }}" target="_blank">🔗</a> <a class="link" href="{{ url_for('rss', name=name) }}" target="_blank">🔗</a>
<a href="{{ url_for('pdf', name=name) }}"><button>pdf</button></a>
<a class="link" href="{{ url_for('pagedjs', name=name) }}" target="_blank">🔗</a>
</div>`; </div>`;
document.body.insertBefore(nav, document.body.firstChild); document.body.insertBefore(nav, document.body.firstChild);

15
templates/podcast.rss

@ -1,3 +1,14 @@
RSS FEED FOR: {{ name }} PODCAST RSS FEED FOR: {{ name }}
{{ rss }} <br><br>
audio found:
<br><br>
{% for link in audio %}
<audio src="{{ link }}" controls></audio>
<br><br>
{% endfor %}

Loading…
Cancel
Save