Fix spotify m3u Windows path parsing
This commit is contained in:
@@ -35,6 +35,18 @@ test("parses artist title patterns", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
test("cleans filename-only track names from dotted and temp media filenames", () => {
|
||||
assert.deepEqual(parseArtistTitle("The.Hills.flac"), [
|
||||
{ source: "The Hills", query: "The Hills", title: "The Hills" }
|
||||
]);
|
||||
assert.deepEqual(parseArtistTitle("15.I Feel It Coming.temp.mp3"), [
|
||||
{ source: "I Feel It Coming", query: "I Feel It Coming", title: "I Feel It Coming" }
|
||||
]);
|
||||
assert.deepEqual(parseArtistTitle("Y.M.C.A..mp3"), [
|
||||
{ source: "Y.M.C.A.", query: "Y.M.C.A.", title: "Y.M.C.A." }
|
||||
]);
|
||||
});
|
||||
|
||||
test("dedupes normalized artist title refs", () => {
|
||||
const refs = dedupeTrackRefs([
|
||||
{ source: "a", query: "Radiohead Karma Police", artist: "Radiohead", title: "Karma Police" },
|
||||
|
||||
@@ -26,6 +26,18 @@ test("falls back to filename when EXTINF is absent", () => {
|
||||
assert.equal(refs[0].title, "Karma Police");
|
||||
});
|
||||
|
||||
test("falls back to the filename from Windows paths", () => {
|
||||
const refs = parseM3u(String.raw`C:\Users\fiori\iCloudDrive\Music\Classic Hits\Owner of a Lonely Heart.mp3`);
|
||||
|
||||
assert.deepEqual(refs, [
|
||||
{
|
||||
source: "Owner of a Lonely Heart",
|
||||
query: "Owner of a Lonely Heart",
|
||||
title: "Owner of a Lonely Heart"
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
test("reads m3u from file", async () => {
|
||||
const root = await mkdtemp(join(tmpdir(), "spotify-m3u-"));
|
||||
const path = join(root, "playlist.m3u8");
|
||||
|
||||
Reference in New Issue
Block a user