Der Podcast-Tab der Web-App zeigt jetzt dieselbe Oberfläche wie die Android-App: native-podcast.js aus diora-android, unverändert kopiert nach static/podcasts/ (tools/sync_podcast_ui.py, mit Quell-Commit im Kopf), dazu die Podcast-Teile von native.css. static/js/podcasts-web.js spielt im Browser die Rolle der App (window.DioraPodcastHost statt DioraNative): - Zustand aus /podcasts/state/, in localStorage für einen schnellen Start; Änderungen sofort lokal und der Reihe nach an den Server (Outbox, übersteht Neuladen und Offline), wie Podcasts.kt, inkl. „immer sortiert halten“ - eigener Player (nicht das Radio-Audio-Element), Warteschlange = Playlist, wie RadioService.EpisodeTracker: Stelle fortsetzen, Intro/Outro, Fortschritt alle 10 s und bei Pause, „gehört“ kurz vor Schluss (auch bei „nächste“), automatisch weiter, nach Pause etwas zurück (0,8/3/10/20 s), Tempo und Lautstärke (bis 1) pro Podcast, Sleep-Timer nur während des Abspielens mit Ausblenden - Sperrbildschirm und Medientasten über navigator.mediaSession - Abspiel-Einstellungen dieses Geräts in localStorage (wie PlaybackPrefs) - keine Downloads (die Oberfläche blendet sie aus) - Radio und Podcast nie gleichzeitig: eine Folge stoppt das Radio, ein Sender legt die Folge weg - Bottom-Sheet und Mini-Player-Dock über der Radio-Leiste; auf breiten Bildschirmen eine mittige Spalte (760 px) In der App und der Desktop-App (window.DioraNative vorhanden) tut podcasts-web.js nichts. Entfernt: der alte Podcast-Tab (Markup, ~1000 Zeilen in app.js, CSS), die Podcast-Leiste im Player, INITIAL_PODCAST_FEEDS und das Herunterladen von Folgen in den Browser-Cache (der Service Worker räumt diora-podcast-v1 ab). Service-Worker-Cache auf v52, neue Dateien im App-Shell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.9 KiB
Python
40 lines
1.9 KiB
Python
from pathlib import Path
|
|
|
|
from django.conf import settings
|
|
from django.contrib.auth.models import User
|
|
from django.test import TestCase
|
|
|
|
|
|
class PlayerPagePodcastsTests(TestCase):
|
|
"""The podcast tab is the app's podcast page (static/podcasts/, copied from
|
|
diora-android) on a browser host (static/js/podcasts-web.js)."""
|
|
|
|
def test_logged_in_page_loads_the_podcast_host(self):
|
|
user = User.objects.create_user('pod', password='pw-for-tests-only')
|
|
self.client.force_login(user)
|
|
html = self.client.get('/').content.decode()
|
|
self.assertIn('id="tab-podcasts"', html)
|
|
self.assertIn('<script src="/static/js/podcasts-web.js"></script>', html)
|
|
self.assertIn('dpw-loading', html)
|
|
# The old podcast tab and its player bar are gone.
|
|
self.assertNotIn('podcast-toolbar', html)
|
|
self.assertNotIn('podcast-seek-bar', html)
|
|
self.assertNotIn('INITIAL_PODCAST_FEEDS', html)
|
|
|
|
def test_logged_out_page_asks_to_log_in(self):
|
|
html = self.client.get('/').content.decode()
|
|
self.assertIn('to subscribe to podcasts.', html)
|
|
self.assertNotIn('dpw-loading', html)
|
|
|
|
def test_podcast_ui_files_are_there(self):
|
|
static = Path(settings.BASE_DIR) / 'static'
|
|
host = (static / 'js' / 'podcasts-web.js').read_text(encoding='utf-8')
|
|
for name in ('native-podcast.js', 'podcast-ui.css', 'podcasts-web.css'):
|
|
path = static / 'podcasts' / name
|
|
self.assertTrue(path.exists(), name)
|
|
if name != 'podcasts-web.css':
|
|
self.assertIn('Copied from diora-android', path.read_text(encoding='utf-8')[:300])
|
|
self.assertIn('/static/podcasts/' + name, host)
|
|
sw = (static / 'js' / 'sw.js').read_text(encoding='utf-8')
|
|
for path in ('/static/js/podcasts-web.js', '/static/podcasts/native-podcast.js'):
|
|
self.assertIn(path, sw)
|