Smart playlists (#476)

A playlist is the episodes of the podcasts chosen, those set to play first
ahead of the rest, newest or oldest first, unplayed only or all, kept up to
date by itself (table `playlists`, /api/playlists). It sits in a folder of its
own in the feed list, as Signals do. Played from one, an episode goes on to
the playlist's next once Up Next has nothing.

The priority ids are written into the ORDER BY, which the page query uses
twice, so they are quoted there rather than bound; they are also only ever
feed ids this person subscribes to.

The folder row first borrowed Signals' `sigs` class, which the tests use to
mean Signals' folder; four Signals tests failed until it had its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 14:54:19 +00:00
parent 2faca684da
commit 02ee6d74c1
17 changed files with 540 additions and 11 deletions

View File

@@ -56,10 +56,13 @@ const queueButton=(e: Entry,cls='iconbtn')=>`<button class="${cls}" data-a="queu
title="${queued(e)?'Remove from Up Next':'Add to Up Next'}" aria-label="${queued(e)?'Remove from Up Next':'Add to Up Next'}">${queued(e)?ICON.queued:ICON.queue}</button>`;
/// What plays after this one ends, or the next button is pressed.
/// Up Next first; with nothing in it, the next in the playlist the one playing came from.
function playNext(){
const e=nextUp(upNext,player.guid?player.feed+'\n'+player.guid:null);
if(e) play(e);
return !!e;
if(e){ play(e); return true; }
const n=nextInPlaylist();
if(n&&playingFrom){ playFrom(playingFrom,n); return true; }
return false;
}
/// Playing takes an episode out of Up Next: it is under way, and Currently Listening has it now.
function startedPlaying(e: Entry){
@@ -69,7 +72,7 @@ function startedPlaying(e: Entry){
/// The phone's player is told what follows (#473), so with the screen locked, when the page is
/// frozen and cannot answer the end of an episode, it goes on to the next by itself.
function hostNext(){
const next=nextUp(upNext,player.guid?player.feed+'\n'+player.guid:null);
const next=nextUp(upNext,player.guid?player.feed+'\n'+player.guid:null)??nextInPlaylist();
$<HTMLButtonElement>('#pnext').hidden=!next;
try{
if(!ipxHost||!hostCan.has('next')) return;