mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-09 10:51:37 +00:00
Compare commits
No commits in common. "9bf8d7de11b969bb7ece861d0321db33d1b016c9" and "1f7be58124dce737ac252d08a7eefaa6990a6077" have entirely different histories.
9bf8d7de11
...
1f7be58124
2 changed files with 17 additions and 19 deletions
|
|
@ -52,7 +52,9 @@ class FantLab {
|
||||||
return []
|
return []
|
||||||
})
|
})
|
||||||
|
|
||||||
return Promise.all(items.map(async (item) => await this.getWork(item, timeout))).then((resArray) => resArray.filter(Boolean))
|
return Promise.all(items.map(async (item) => await this.getWork(item, timeout))).then((resArray) => {
|
||||||
|
return resArray.filter((res) => res)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -81,10 +83,6 @@ class FantLab {
|
||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!bookData) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.cleanBookData(bookData, timeout)
|
return this.cleanBookData(bookData, timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -251,15 +251,6 @@ module.exports = {
|
||||||
*/
|
*/
|
||||||
getOrder(sortBy, sortDesc, collapseseries) {
|
getOrder(sortBy, sortDesc, collapseseries) {
|
||||||
const dir = sortDesc ? 'DESC' : 'ASC'
|
const dir = sortDesc ? 'DESC' : 'ASC'
|
||||||
|
|
||||||
const getTitleOrder = () => {
|
|
||||||
if (global.ServerSettings.sortingIgnorePrefix) {
|
|
||||||
return [Sequelize.literal('`libraryItem`.`titleIgnorePrefix` COLLATE NOCASE'), dir]
|
|
||||||
} else {
|
|
||||||
return [Sequelize.literal('`libraryItem`.`title` COLLATE NOCASE'), dir]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sortBy === 'addedAt') {
|
if (sortBy === 'addedAt') {
|
||||||
return [[Sequelize.literal('libraryItem.createdAt'), dir]]
|
return [[Sequelize.literal('libraryItem.createdAt'), dir]]
|
||||||
} else if (sortBy === 'size') {
|
} else if (sortBy === 'size') {
|
||||||
|
|
@ -273,16 +264,25 @@ module.exports = {
|
||||||
} else if (sortBy === 'media.metadata.publishedYear') {
|
} else if (sortBy === 'media.metadata.publishedYear') {
|
||||||
return [[Sequelize.literal(`CAST(\`book\`.\`publishedYear\` AS INTEGER)`), dir]]
|
return [[Sequelize.literal(`CAST(\`book\`.\`publishedYear\` AS INTEGER)`), dir]]
|
||||||
} else if (sortBy === 'media.metadata.authorNameLF') {
|
} else if (sortBy === 'media.metadata.authorNameLF') {
|
||||||
// Sort by author name last first, secondary sort by title
|
return [
|
||||||
return [[Sequelize.literal('`libraryItem`.`authorNamesLastFirst` COLLATE NOCASE'), dir], getTitleOrder()]
|
[Sequelize.literal('`libraryItem`.`authorNamesLastFirst` COLLATE NOCASE'), dir],
|
||||||
|
[Sequelize.literal('`libraryItem`.`title` COLLATE NOCASE'), dir]
|
||||||
|
]
|
||||||
} else if (sortBy === 'media.metadata.authorName') {
|
} else if (sortBy === 'media.metadata.authorName') {
|
||||||
// Sort by author name first last, secondary sort by title
|
return [
|
||||||
return [[Sequelize.literal('`libraryItem`.`authorNamesFirstLast` COLLATE NOCASE'), dir], getTitleOrder()]
|
[Sequelize.literal('`libraryItem`.`authorNamesFirstLast` COLLATE NOCASE'), dir],
|
||||||
|
[Sequelize.literal('`libraryItem`.`title` COLLATE NOCASE'), dir]
|
||||||
|
]
|
||||||
} else if (sortBy === 'media.metadata.title') {
|
} else if (sortBy === 'media.metadata.title') {
|
||||||
if (collapseseries) {
|
if (collapseseries) {
|
||||||
return [[Sequelize.literal('display_title COLLATE NOCASE'), dir]]
|
return [[Sequelize.literal('display_title COLLATE NOCASE'), dir]]
|
||||||
}
|
}
|
||||||
return [getTitleOrder()]
|
|
||||||
|
if (global.ServerSettings.sortingIgnorePrefix) {
|
||||||
|
return [[Sequelize.literal('`libraryItem`.`titleIgnorePrefix` COLLATE NOCASE'), dir]]
|
||||||
|
} else {
|
||||||
|
return [[Sequelize.literal('`libraryItem`.`title` COLLATE NOCASE'), dir]]
|
||||||
|
}
|
||||||
} else if (sortBy === 'sequence') {
|
} else if (sortBy === 'sequence') {
|
||||||
const nullDir = sortDesc ? 'DESC NULLS FIRST' : 'ASC NULLS LAST'
|
const nullDir = sortDesc ? 'DESC NULLS FIRST' : 'ASC NULLS LAST'
|
||||||
return [[Sequelize.literal(`CAST(\`series.bookSeries.sequence\` AS FLOAT) ${nullDir}`)]]
|
return [[Sequelize.literal(`CAST(\`series.bookSeries.sequence\` AS FLOAT) ${nullDir}`)]]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue