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

This commit is contained in:
mb 2023-11-30 10:53:01 +01:00
parent f7076c8f88
commit 5520464845
4 changed files with 24 additions and 9 deletions

View File

@ -131,8 +131,7 @@ def get_app_hostname():
# app_url = urlparse(request.base_url).netloc
# app_hostname = app_protocol + app_url
# app_hostname = "http://localhost:5555" # hardcoded for now
app_hostname = "https://circulations.constantvzw.org" # hardcoded for now
app_hostname = APP.config['APPLICATION_HOSTNAME']
return app_hostname
@ -246,9 +245,13 @@ def pagedjs(name):
def rss(name):
# TO GENERATE THE PODCAST RSS FEED
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)
# //////////////////

View File

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

View File

@ -36,12 +36,12 @@ window.addEventListener('load', function () {
<a href="{{ url_for('html', name=name) }}"><button>html</button></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 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>`;
document.body.insertBefore(nav, document.body.firstChild);

View File

@ -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 %}