mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-13 06:51:29 +00:00
update
This commit is contained in:
parent
f4ce4a4bde
commit
e5261d137f
3 changed files with 111 additions and 39 deletions
|
|
@ -33,6 +33,7 @@ describe('scanUtils', async () => {
|
|||
const dirname = Path.dirname(filePath)
|
||||
fileItems.push({
|
||||
name: Path.basename(filePath),
|
||||
path: filePath,
|
||||
reldirpath: dirname === '.' ? '' : dirname,
|
||||
extension: Path.extname(filePath),
|
||||
deep: filePath.split('/').length - 1
|
||||
|
|
@ -49,4 +50,43 @@ describe('scanUtils', async () => {
|
|||
'Author/Series2/Book5/deeply/nested': ['cd 01/audiofile.mp3', 'cd 02/audiofile.mp3']
|
||||
})
|
||||
})
|
||||
|
||||
it('should keep nested book folders separate when a parent folder also contains a direct media file', async () => {
|
||||
const filePaths = [
|
||||
'Series Alpha/Standalone Side Story.m4b',
|
||||
'Series Alpha/Standalone Side Story.nfo',
|
||||
'Series Alpha/Author Example - Book One Main Saga, Book 1/Book One Main Saga, Book 1.m4b',
|
||||
'Series Alpha/Author Example - Book One Main Saga, Book 1/Book One Main Saga, Book 1.cue',
|
||||
'Series Alpha/Author Example - Book Two Main Saga, Book 2/Book Two Main Saga, Book 2.m4b',
|
||||
'Series Alpha/Author Example - Book Two Main Saga, Book 2/Book Two Main Saga, Book 2.nfo'
|
||||
]
|
||||
|
||||
const fileItems = filePaths.map((filePath) => {
|
||||
const dirname = Path.dirname(filePath)
|
||||
return {
|
||||
name: Path.basename(filePath),
|
||||
path: filePath,
|
||||
reldirpath: dirname === '.' ? '' : dirname,
|
||||
extension: Path.extname(filePath),
|
||||
deep: filePath.split('/').length - 1
|
||||
}
|
||||
})
|
||||
|
||||
const libraryItemGrouping = scanUtils.groupFileItemsIntoLibraryItemDirs('book', fileItems, false)
|
||||
|
||||
expect(libraryItemGrouping).to.deep.equal({
|
||||
'Series Alpha/Standalone Side Story.m4b': [
|
||||
'Series Alpha/Standalone Side Story.m4b',
|
||||
'Series Alpha/Standalone Side Story.nfo'
|
||||
],
|
||||
'Series Alpha/Author Example - Book One Main Saga, Book 1': [
|
||||
'Book One Main Saga, Book 1.m4b',
|
||||
'Book One Main Saga, Book 1.cue'
|
||||
],
|
||||
'Series Alpha/Author Example - Book Two Main Saga, Book 2': [
|
||||
'Book Two Main Saga, Book 2.m4b',
|
||||
'Book Two Main Saga, Book 2.nfo'
|
||||
]
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue