A seasoned podcast runs in its own order, and a season downloads whole (#482)

Asked for on the issue: lowest to highest, by season and then episode,
and a way to download every episode of a season.

sort=episode orders by season, episode, then date, with the episodes in
none last either way round; a podcast told in seasons opens in it until a
heading is clicked, and its seasons are offered lowest first.
download-latest takes a season and queues every file of it not on iPX,
first episode first, up to 300; the page asks first, since a season can
be gigabytes. The picked season scrolls into view in the picker, and the
count under the list is the season's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RqkrVAJFkEgz9cXG3jG1Zy
This commit is contained in:
2026-11-19 09:21:50 -05:00
parent 4eb6fbb286
commit c441215c62
12 changed files with 168 additions and 44 deletions

View File

@@ -3218,20 +3218,39 @@ test('a reap over the quota says what it would delete and, dry, deletes nothing'
expect(files()).toBe(before);
});
test('a podcast told in seasons is listed one season at a time, or all with each season marked (#482)', async ({ page }) => {
test('a podcast told in seasons runs in its own order, one season at a time or all, and a season downloads whole (#482)', async ({ page }) => {
await page.locator('#feedlist .feed', { hasText: 'Seasoned Show' }).click({ timeout: 20_000 });
await page.locator('#content .tabs button[data-f="all"]').click();
const picker = page.locator('#content .seasons');
await expect(picker.locator('button')).toHaveText(['All seasons', 'Season 2', 'Season 1', 'Other']);
// Every season, newest first: where each starts is said above its first episode.
await expect(page.locator('#eps .sdiv')).toHaveText(['Season 2', 'Other episodes', 'Season 1']);
await expect(picker.locator('button')).toHaveText(['All seasons', 'Season 1', 'Season 2', 'Other']);
// Every season, in the podcast's own order, season 1 episode 1 first: each season's start said.
await expect(page.locator('#eps .ep .t')).toHaveText(['The Pilot', 'Season One Close', 'Season Two Opener', 'Season Two Finale', 'A Bonus Between']);
await expect(page.locator('#eps .sdiv')).toHaveText(['Season 1', 'Season 2', 'Other episodes']);
// A heading clicked sorts by it, newest first, as on any other podcast.
await page.locator('.ephead [data-sort="published"]').click();
await expect(page.locator('#eps .ep .t').first()).toHaveText('Season Two Finale');
await picker.locator('button', { hasText: 'Season 1' }).click();
await expect(page.locator('#content .seasons button', { hasText: 'Season 1' })).toHaveAttribute('aria-pressed', 'true');
await expect(page.locator('#eps .ep .t')).toHaveText(['The Pilot', 'Season One Close']);
await expect(page.locator('#eps .sdiv')).toHaveCount(0);
await expect(page.locator('#content .seasons button', { hasText: 'Season 1' })).toHaveAttribute('aria-pressed', 'true');
// The count under the list is the season's, as the server counts it.
const unread = await page.evaluate(async () => (await fetch('/api/feeds/seasoned-show/seasons').then(r => r.json()))
.find((s: { season?: number }) => s.season === 1).unread);
await expect(page.locator('#count')).toHaveText(`Seasoned Show: 2 items, ${unread} unread`);
// The whole season onto iPX, after asking, its first episode first.
await page.locator('#content .seasondl').click();
await page.locator('#sgo').click();
// By its words: each file's own toast follows at once on the fixtures' tiny files.
await expect(page.locator('.toast', { hasText: /Downloading 2 episodes of Season 1|All of Season 1 is on iPX already/ })).toBeAttached();
await expect.poll(async () => page.evaluate(async () => (await fetch('/api/feeds/seasoned-show/entries?season=1').then(r => r.json()))
.entries.every((e: { enclosures: { path: string | null }[] }) => e.enclosures.every(x => x.path))), { timeout: 20_000 }).toBe(true);
expect(await page.evaluate(async () => (await fetch('/api/feeds/seasoned-show/entries?season=2').then(r => r.json()))
.entries.some((e: { enclosures: { path: string | null }[] }) => e.enclosures.some(x => x.path)))).toBe(false);
await page.locator('#content .seasons button', { hasText: 'Other' }).click();
await expect(page.locator('#eps .ep .t')).toHaveText(['A Bonus Between']);
// A podcast with one season has no picker, and opening it starts from every season again.
// A podcast with one season has no picker, and opening it again starts from every season.
await page.locator('#feedlist .feed', { hasText: 'Test Show' }).first().click();
await expect(page.locator('#content .seasons')).toHaveCount(0);
await page.locator('#feedlist .feed', { hasText: 'Seasoned Show' }).click();

View File

@@ -2,12 +2,16 @@
<rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<channel><title>Seasoned Show</title><link>http://127.0.0.1:8792/</link><description>A fixture podcast told in seasons (#482).</description>
<item><title>Season Two Finale</title><guid>sn-4</guid><pubDate>Mon, 01 Jun 2026 10:00:00 +0000</pubDate>
<itunes:season>2</itunes:season><itunes:episode>2</itunes:episode></item>
<itunes:season>2</itunes:season><itunes:episode>2</itunes:episode>
<enclosure url="http://127.0.0.1:8792/ep2.mp3?s2e2" length="40000" type="audio/mpeg"/></item>
<item><title>Season Two Opener</title><guid>sn-3</guid><pubDate>Mon, 25 May 2026 10:00:00 +0000</pubDate>
<itunes:season>2</itunes:season><itunes:episode>1</itunes:episode></item>
<itunes:season>2</itunes:season><itunes:episode>1</itunes:episode>
<enclosure url="http://127.0.0.1:8792/ep2.mp3?s2e1" length="40000" type="audio/mpeg"/></item>
<item><title>A Bonus Between</title><guid>sn-b</guid><pubDate>Mon, 18 May 2026 10:00:00 +0000</pubDate></item>
<item><title>The Pilot</title><guid>sn-1</guid><pubDate>Mon, 11 May 2026 10:00:00 +0000</pubDate>
<itunes:season>1</itunes:season><itunes:episode>1</itunes:episode></item>
<itunes:season>1</itunes:season><itunes:episode>1</itunes:episode>
<enclosure url="http://127.0.0.1:8792/ep2.mp3?s1e1" length="40000" type="audio/mpeg"/></item>
<item><title>Season One Close</title><guid>sn-2</guid><pubDate>Mon, 04 May 2026 10:00:00 +0000</pubDate>
<itunes:season>1</itunes:season><itunes:episode>2</itunes:episode></item>
<itunes:season>1</itunes:season><itunes:episode>2</itunes:episode>
<enclosure url="http://127.0.0.1:8792/ep2.mp3?s1e2" length="40000" type="audio/mpeg"/></item>
</channel></rss>