diff --git a/client/pages/config/custom-metadata-providers.vue b/client/pages/config/custom-metadata-providers.vue index 10fdb21b..9f394eae 100644 --- a/client/pages/config/custom-metadata-providers.vue +++ b/client/pages/config/custom-metadata-providers.vue @@ -9,7 +9,7 @@
-http://192.168.1.1:8337
then you would put http://192.168.1.1:8337/notify
.",
"MessageBackupsDescription": "Backups include users, user progress, library item details, server settings, and images stored in /metadata/items
& /metadata/authors
. Backups do not include any files stored in your library folders.",
diff --git a/custom-metadata-provider-specification.yaml b/custom-metadata-provider-specification.yaml
index 3201fbb8..90df875b 100644
--- a/custom-metadata-provider-specification.yaml
+++ b/custom-metadata-provider-specification.yaml
@@ -86,7 +86,7 @@ components:
type: string
publisher:
type: string
- published_year:
+ publishedYear:
type: string
description:
type: string
@@ -107,6 +107,17 @@ components:
type: array
items:
type: string
+ series:
+ type: array
+ items:
+ type: object
+ properties:
+ series:
+ type: string
+ required: true
+ sequence:
+ type: number
+ format: int64
language:
type: string
duration:
diff --git a/server/controllers/MiscController.js b/server/controllers/MiscController.js
index 76140dcc..1d2fff04 100644
--- a/server/controllers/MiscController.js
+++ b/server/controllers/MiscController.js
@@ -763,7 +763,7 @@ class MiscController {
return res.sendStatus(403)
}
- const { name, url, apiKey } = req.body;
+ const { name, url, apiKey } = req.body
if (!name || !url || !apiKey) {
return res.status(500).send(`Invalid patch data`)
@@ -794,18 +794,18 @@ class MiscController {
return res.sendStatus(403)
}
- const { id } = req.params;
+ const { id } = req.params
if (!id) {
return res.status(500).send(`Invalid delete data`)
}
- const provider = await Database.customMetadataProviderModel.findByPk(id);
- await Database.removeCustomMetadataProviderById(id);
+ const provider = await Database.customMetadataProviderModel.findByPk(id)
+ await Database.removeCustomMetadataProviderById(id)
SocketAuthority.adminEmitter('custom_metadata_provider_removed', provider)
- res.json({})
+ res.sendStatus(200)
}
}
module.exports = new MiscController()
diff --git a/server/models/CustomMetadataProvider.js b/server/models/CustomMetadataProvider.js
index 9bc175c4..d6047bb8 100644
--- a/server/models/CustomMetadataProvider.js
+++ b/server/models/CustomMetadataProvider.js
@@ -26,13 +26,7 @@ class CustomMetadataProvider extends Model {
}
}
- static findByPk(id) {
- return this.findOne({
- where: {
- id,
- }
- })
- }
+
/**
* Initialize model
@@ -47,7 +41,7 @@ class CustomMetadataProvider extends Model {
},
name: DataTypes.STRING,
url: DataTypes.STRING,
- apiKey: DataTypes.STRING
+ apiKey: DataTypes.STRING,
}, {
sequelize,
modelName: 'customMetadataProvider'
diff --git a/server/providers/CustomProviderAdapter.js b/server/providers/CustomProviderAdapter.js
index d5f64291..1919ecc9 100644
--- a/server/providers/CustomProviderAdapter.js
+++ b/server/providers/CustomProviderAdapter.js
@@ -1,6 +1,6 @@
const Database = require('../Database')
-const axios = require("axios");
-const Logger = require("../Logger");
+const axios = require("axios")
+const Logger = require("../Logger")
class CustomProviderAdapter {
constructor() {
@@ -8,10 +8,10 @@ class CustomProviderAdapter {
async search(title, author, providerSlug) {
const providerId = providerSlug.split("custom-")[1]
- const provider = await Database.customMetadataProviderModel.findByPk(providerId);
+ const provider = await Database.customMetadataProviderModel.findByPk(providerId)
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)}` : ""}`, {
@@ -27,7 +27,7 @@ class CustomProviderAdapter {
})
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
@@ -37,13 +37,14 @@ class CustomProviderAdapter {
author,
narrator,
publisher,
- published_year,
+ publishedYear,
description,
cover,
isbn,
asin,
genres,
tags,
+ series,
language,
duration,
}) => {
@@ -53,13 +54,14 @@ class CustomProviderAdapter {
author,
narrator,
publisher,
- publishedYear: published_year,
+ publishedYear,
description,
cover,
isbn,
asin,
genres,
tags: tags.join(","),
+ series: series.length ? series : null,
language,
duration,
}