mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 08:21:39 -06:00
fix(scanner): treat pt ## audiobook subfolders as part folders
The scanner disc directory pattern previously recognized cd, disc, disk, part, and side, but not pt. This caused Pt subfolders to be treated as separate books instead of being merged into the parent audiobook. This change adds pt as an accepted disc/part folder prefix. Closes #262
This commit is contained in:
@@ -378,15 +378,16 @@ describe('disc folder flattening', () => {
|
||||
expect(candidates[0].files).toHaveLength(3);
|
||||
});
|
||||
|
||||
it('flattens Disc, Disk, Part, Side patterns', async () => {
|
||||
it('flattens Disc, Disk, Part, Pt, Side patterns', async () => {
|
||||
await file('MultiDisc/Disc 1/track-01.mp3');
|
||||
await file('MultiDisc/Disk 2/track-02.mp3');
|
||||
await file('MultiDisc/Part 3/track-03.mp3');
|
||||
await file('MultiDisc/Side A/track-04.mp3');
|
||||
await file('MultiDisc/Pt 04/track-04.mp3');
|
||||
await file('MultiDisc/Side A/track-05.mp3');
|
||||
|
||||
const { candidates } = await findBookCandidates(root);
|
||||
expect(candidates).toHaveLength(1);
|
||||
expect(candidates[0].files).toHaveLength(4);
|
||||
expect(candidates[0].files).toHaveLength(5);
|
||||
});
|
||||
|
||||
it('does NOT flatten directories that do not match the disc pattern', async () => {
|
||||
|
||||
@@ -45,7 +45,7 @@ const DIR_CONCURRENCY_LIMIT = 50;
|
||||
|
||||
// Matches common disc subdirectory names: "CD 1", "Disc 2", "Disk03", "Part A", "Side IV"
|
||||
// but avoids broad matches like "Discography".
|
||||
const DISC_DIR_PATTERN = /^(?:cd|disc|disk|part|side)(?:[\s_-]*(?:\d+|[A-Za-z]|[IVXLCM]+))$/i;
|
||||
const DISC_DIR_PATTERN = /^(?:cd|disc|disk|part|pt|side)(?:[\s_-]*(?:\d+|[A-Za-z]|[IVXLCM]+))$/i;
|
||||
|
||||
function isDiscDirectory(name: string): boolean {
|
||||
return DISC_DIR_PATTERN.test(name);
|
||||
|
||||
Reference in New Issue
Block a user