Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nixamp",
"version": "0.80.2",
"version": "0.80.3",
"description": "It really whips the terminal's ass. A Winamp-shaped audio player for your terminal.",
"license": "MIT",
"type": "module",
Expand Down
7 changes: 6 additions & 1 deletion src/guide-rooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ interface ChannelRow {
name?: string;
kind?: string;
live?: boolean;
/** Wall clock when its show ended (the outro is playing). */
ended?: number;
playlist?: unknown[];
codecs?: { tags?: { title?: string; artist?: string; album?: string } };
}
Expand Down Expand Up @@ -211,7 +213,10 @@ export class RoomProbe {
if (!row) return null;
const tags = row.codecs?.tags;
return {
live: row.live !== false,
// On the air until its show has ended. The row's own `live` says whether
// the SOURCE is a live feed: a podcast mp3 carried as a channel is
// live:false the whole time it plays, and its room read as offline.
live: !row.ended,
name: String(row.name ?? address.channel).replace(/\/+$/, "").slice(0, 120),
kind: row.kind === "video" ? "video" : "audio",
nowPlaying: tags && (tags.title || tags.artist) ? { title: String(tags.title ?? ""), artist: String(tags.artist ?? "") } : null,
Expand Down
4 changes: 4 additions & 0 deletions test/guide-rooms.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ test("the probe reads a room's name, kind and what is on from its own server, an
const probe = new RoomProbe(fakeServer([CHANNEL]));
assert.deepEqual(await probe.state(PLAY), { live: true, name: "Dropkick Murphys - Studio Discography", kind: "audio", nowPlaying: { title: "John Law", artist: "Dropkick Murphys" }, folder: true, album: "" });
assert.equal(await new RoomProbe(fakeServer([])).state(PLAY), null);
// A podcast mp3 carried as a channel is not a live SOURCE but is on the air until it ends.
const episode = { id: "folder-b19b85542264", name: "Episode 1", kind: "audio", live: false };
assert.equal((await new RoomProbe(fakeServer([episode])).state(PLAY))?.live, true);
assert.equal((await new RoomProbe(fakeServer([{ ...episode, ended: Date.now() }])).state(PLAY))?.live, false);
assert.equal(await new RoomProbe(fakeServer([CHANNEL]), async () => "a private address").state(PLAY), null);
});

Expand Down
Loading