Use transcodedContentType when available to indicate to sonos device the transcoded mimeType #191 (#192)

This commit is contained in:
Simon J
2024-02-02 19:43:53 +11:00
committed by GitHub
parent 1a251400ec
commit 66c248fe44
5 changed files with 28 additions and 7 deletions

View File

@@ -322,6 +322,7 @@ const asSongJson = (track: Track) => ({
size: "5624132",
suffix: "mp3",
contentType: track.mimeType,
transcodedContentType: undefined,
isVideo: "false",
path: "ACDC/High voltage/ACDC - The Jack.mp3",
albumId: track.album.id,
@@ -686,8 +687,31 @@ describe("asTrack", () => {
});
});
});
describe("when the song has a transcodedContentType", () => {
const album = anAlbum();
describe("with an undefined value", () => {
const track = aTrack({ mimeType: "sourced-from/mimeType" });
it("should fall back on the default mime", () => {
const result = asTrack(album, { ...asSongJson(track), transcodedContentType: undefined });
expect(result.mimeType).toEqual("sourced-from/mimeType")
});
});
describe("with a value", () => {
const track = aTrack({ mimeType: "sourced-from/mimeType" });
it("should use the transcoded value", () => {
const result = asTrack(album, { ...asSongJson(track), transcodedContentType: "sourced-from/transcodedContentType" });
expect(result.mimeType).toEqual("sourced-from/transcodedContentType")
});
});
});
});
describe("Subsonic", () => {
const url = new URLBuilder("http://127.0.0.22:4567/some-context-path");
const username = `user1-${uuid()}`;