mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
implemented suggestions, extended CMPs with series
This commit is contained in:
parent
12c6a1baa0
commit
3b531144cf
@ -9,7 +9,7 @@
|
|||||||
</ui-tooltip>
|
</ui-tooltip>
|
||||||
<div class="flex-grow" />
|
<div class="flex-grow" />
|
||||||
|
|
||||||
<ui-btn color="primary" small @click="setShowAddModal()">{{ $strings.ButtonAdd }}</ui-btn>
|
<ui-btn color="primary" small @click="setShowAddModal">{{ $strings.ButtonAdd }}</ui-btn>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<tables-custom-metadata-provider-table class="pt-2" />
|
<tables-custom-metadata-provider-table class="pt-2" />
|
||||||
@ -40,6 +40,4 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
|
@ -96,7 +96,6 @@
|
|||||||
"HeaderAudiobookTools": "Audiobook File Management Tools",
|
"HeaderAudiobookTools": "Audiobook File Management Tools",
|
||||||
"HeaderAudioTracks": "Audio Tracks",
|
"HeaderAudioTracks": "Audio Tracks",
|
||||||
"HeaderAuthentication": "Authentication",
|
"HeaderAuthentication": "Authentication",
|
||||||
"HeaderCustomMetadataProviders": "Custom metadata providers",
|
|
||||||
"HeaderBackups": "Backups",
|
"HeaderBackups": "Backups",
|
||||||
"HeaderChangePassword": "Change Password",
|
"HeaderChangePassword": "Change Password",
|
||||||
"HeaderChapters": "Chapters",
|
"HeaderChapters": "Chapters",
|
||||||
@ -105,6 +104,7 @@
|
|||||||
"HeaderCollectionItems": "Collection Items",
|
"HeaderCollectionItems": "Collection Items",
|
||||||
"HeaderCover": "Cover",
|
"HeaderCover": "Cover",
|
||||||
"HeaderCurrentDownloads": "Current Downloads",
|
"HeaderCurrentDownloads": "Current Downloads",
|
||||||
|
"HeaderCustomMetadataProviders": "Custom metadata providers",
|
||||||
"HeaderDetails": "Details",
|
"HeaderDetails": "Details",
|
||||||
"HeaderDownloadQueue": "Download Queue",
|
"HeaderDownloadQueue": "Download Queue",
|
||||||
"HeaderEbookFiles": "Ebook Files",
|
"HeaderEbookFiles": "Ebook Files",
|
||||||
@ -194,6 +194,7 @@
|
|||||||
"LabelAllUsersExcludingGuests": "All users excluding guests",
|
"LabelAllUsersExcludingGuests": "All users excluding guests",
|
||||||
"LabelAllUsersIncludingGuests": "All users including guests",
|
"LabelAllUsersIncludingGuests": "All users including guests",
|
||||||
"LabelAlreadyInYourLibrary": "Already in your library",
|
"LabelAlreadyInYourLibrary": "Already in your library",
|
||||||
|
"LabelApiKey": "API Key",
|
||||||
"LabelAppend": "Append",
|
"LabelAppend": "Append",
|
||||||
"LabelAuthor": "Author",
|
"LabelAuthor": "Author",
|
||||||
"LabelAuthorFirstLast": "Author (First Last)",
|
"LabelAuthorFirstLast": "Author (First Last)",
|
||||||
@ -526,6 +527,7 @@
|
|||||||
"LabelUploaderDragAndDrop": "Drag & drop files or folders",
|
"LabelUploaderDragAndDrop": "Drag & drop files or folders",
|
||||||
"LabelUploaderDropFiles": "Drop files",
|
"LabelUploaderDropFiles": "Drop files",
|
||||||
"LabelUploaderItemFetchMetadataHelp": "Automatically fetch title, author, and series",
|
"LabelUploaderItemFetchMetadataHelp": "Automatically fetch title, author, and series",
|
||||||
|
"LabelUrl": "URL",
|
||||||
"LabelUseChapterTrack": "Use chapter track",
|
"LabelUseChapterTrack": "Use chapter track",
|
||||||
"LabelUseFullTrack": "Use full track",
|
"LabelUseFullTrack": "Use full track",
|
||||||
"LabelUser": "User",
|
"LabelUser": "User",
|
||||||
@ -541,8 +543,6 @@
|
|||||||
"LabelYourBookmarks": "Your Bookmarks",
|
"LabelYourBookmarks": "Your Bookmarks",
|
||||||
"LabelYourPlaylists": "Your Playlists",
|
"LabelYourPlaylists": "Your Playlists",
|
||||||
"LabelYourProgress": "Your Progress",
|
"LabelYourProgress": "Your Progress",
|
||||||
"LabelUrl": "URL",
|
|
||||||
"LabelApiKey": "API Key",
|
|
||||||
"MessageAddToPlayerQueue": "Add to player queue",
|
"MessageAddToPlayerQueue": "Add to player queue",
|
||||||
"MessageAppriseDescription": "To use this feature you will need to have an instance of <a href=\"https://github.com/caronc/apprise-api\" target=\"_blank\">Apprise API</a> running or an api that will handle those same requests. <br />The Apprise API Url should be the full URL path to send the notification, e.g., if your API instance is served at <code>http://192.168.1.1:8337</code> then you would put <code>http://192.168.1.1:8337/notify</code>.",
|
"MessageAppriseDescription": "To use this feature you will need to have an instance of <a href=\"https://github.com/caronc/apprise-api\" target=\"_blank\">Apprise API</a> running or an api that will handle those same requests. <br />The Apprise API Url should be the full URL path to send the notification, e.g., if your API instance is served at <code>http://192.168.1.1:8337</code> then you would put <code>http://192.168.1.1:8337/notify</code>.",
|
||||||
"MessageBackupsDescription": "Backups include users, user progress, library item details, server settings, and images stored in <code>/metadata/items</code> & <code>/metadata/authors</code>. Backups <strong>do not</strong> include any files stored in your library folders.",
|
"MessageBackupsDescription": "Backups include users, user progress, library item details, server settings, and images stored in <code>/metadata/items</code> & <code>/metadata/authors</code>. Backups <strong>do not</strong> include any files stored in your library folders.",
|
||||||
|
@ -86,7 +86,7 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
publisher:
|
publisher:
|
||||||
type: string
|
type: string
|
||||||
published_year:
|
publishedYear:
|
||||||
type: string
|
type: string
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
@ -107,6 +107,17 @@ components:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
|
series:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
series:
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
sequence:
|
||||||
|
type: number
|
||||||
|
format: int64
|
||||||
language:
|
language:
|
||||||
type: string
|
type: string
|
||||||
duration:
|
duration:
|
||||||
|
@ -763,7 +763,7 @@ class MiscController {
|
|||||||
return res.sendStatus(403)
|
return res.sendStatus(403)
|
||||||
}
|
}
|
||||||
|
|
||||||
const { name, url, apiKey } = req.body;
|
const { name, url, apiKey } = req.body
|
||||||
|
|
||||||
if (!name || !url || !apiKey) {
|
if (!name || !url || !apiKey) {
|
||||||
return res.status(500).send(`Invalid patch data`)
|
return res.status(500).send(`Invalid patch data`)
|
||||||
@ -794,18 +794,18 @@ class MiscController {
|
|||||||
return res.sendStatus(403)
|
return res.sendStatus(403)
|
||||||
}
|
}
|
||||||
|
|
||||||
const { id } = req.params;
|
const { id } = req.params
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return res.status(500).send(`Invalid delete data`)
|
return res.status(500).send(`Invalid delete data`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const provider = await Database.customMetadataProviderModel.findByPk(id);
|
const provider = await Database.customMetadataProviderModel.findByPk(id)
|
||||||
await Database.removeCustomMetadataProviderById(id);
|
await Database.removeCustomMetadataProviderById(id)
|
||||||
|
|
||||||
SocketAuthority.adminEmitter('custom_metadata_provider_removed', provider)
|
SocketAuthority.adminEmitter('custom_metadata_provider_removed', provider)
|
||||||
|
|
||||||
res.json({})
|
res.sendStatus(200)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = new MiscController()
|
module.exports = new MiscController()
|
||||||
|
@ -26,13 +26,7 @@ class CustomMetadataProvider extends Model {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static findByPk(id) {
|
|
||||||
return this.findOne({
|
|
||||||
where: {
|
|
||||||
id,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize model
|
* Initialize model
|
||||||
@ -47,7 +41,7 @@ class CustomMetadataProvider extends Model {
|
|||||||
},
|
},
|
||||||
name: DataTypes.STRING,
|
name: DataTypes.STRING,
|
||||||
url: DataTypes.STRING,
|
url: DataTypes.STRING,
|
||||||
apiKey: DataTypes.STRING
|
apiKey: DataTypes.STRING,
|
||||||
}, {
|
}, {
|
||||||
sequelize,
|
sequelize,
|
||||||
modelName: 'customMetadataProvider'
|
modelName: 'customMetadataProvider'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const Database = require('../Database')
|
const Database = require('../Database')
|
||||||
const axios = require("axios");
|
const axios = require("axios")
|
||||||
const Logger = require("../Logger");
|
const Logger = require("../Logger")
|
||||||
|
|
||||||
class CustomProviderAdapter {
|
class CustomProviderAdapter {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -8,10 +8,10 @@ class CustomProviderAdapter {
|
|||||||
|
|
||||||
async search(title, author, providerSlug) {
|
async search(title, author, providerSlug) {
|
||||||
const providerId = providerSlug.split("custom-")[1]
|
const providerId = providerSlug.split("custom-")[1]
|
||||||
const provider = await Database.customMetadataProviderModel.findByPk(providerId);
|
const provider = await Database.customMetadataProviderModel.findByPk(providerId)
|
||||||
|
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
throw new Error("Custom provider not found for the given id");
|
throw new Error("Custom provider not found for the given id")
|
||||||
}
|
}
|
||||||
|
|
||||||
const matches = await axios.get(`${provider.url}/search?query=${encodeURIComponent(title)}${!!author ? `&author=${encodeURIComponent(author)}` : ""}`, {
|
const matches = await axios.get(`${provider.url}/search?query=${encodeURIComponent(title)}${!!author ? `&author=${encodeURIComponent(author)}` : ""}`, {
|
||||||
@ -27,7 +27,7 @@ class CustomProviderAdapter {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (matches === null) {
|
if (matches === null) {
|
||||||
throw new Error("Custom provider returned malformed response");
|
throw new Error("Custom provider returned malformed response")
|
||||||
}
|
}
|
||||||
|
|
||||||
// re-map keys to throw out
|
// re-map keys to throw out
|
||||||
@ -37,13 +37,14 @@ class CustomProviderAdapter {
|
|||||||
author,
|
author,
|
||||||
narrator,
|
narrator,
|
||||||
publisher,
|
publisher,
|
||||||
published_year,
|
publishedYear,
|
||||||
description,
|
description,
|
||||||
cover,
|
cover,
|
||||||
isbn,
|
isbn,
|
||||||
asin,
|
asin,
|
||||||
genres,
|
genres,
|
||||||
tags,
|
tags,
|
||||||
|
series,
|
||||||
language,
|
language,
|
||||||
duration,
|
duration,
|
||||||
}) => {
|
}) => {
|
||||||
@ -53,13 +54,14 @@ class CustomProviderAdapter {
|
|||||||
author,
|
author,
|
||||||
narrator,
|
narrator,
|
||||||
publisher,
|
publisher,
|
||||||
publishedYear: published_year,
|
publishedYear,
|
||||||
description,
|
description,
|
||||||
cover,
|
cover,
|
||||||
isbn,
|
isbn,
|
||||||
asin,
|
asin,
|
||||||
genres,
|
genres,
|
||||||
tags: tags.join(","),
|
tags: tags.join(","),
|
||||||
|
series: series.length ? series : null,
|
||||||
language,
|
language,
|
||||||
duration,
|
duration,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user