🔧 Cleaned up unused code and bumped filename-parser
This commit is contained in:
@@ -63,7 +63,7 @@ const ComicSchema = mongoose.Schema({
|
|||||||
inferredMetadata: {
|
inferredMetadata: {
|
||||||
issue: {
|
issue: {
|
||||||
name: String,
|
name: String,
|
||||||
number: { type: Number, es_indexed: true },
|
number: { type: Number, es_indexed: true, required: false, default: 0 },
|
||||||
year: String,
|
year: String,
|
||||||
subtitle: String,
|
subtitle: String,
|
||||||
}
|
}
|
||||||
@@ -83,6 +83,7 @@ const ComicSchema = mongoose.Schema({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, { timestamps: true});
|
}, { timestamps: true});
|
||||||
|
|
||||||
ComicSchema.plugin(mexp, {
|
ComicSchema.plugin(mexp, {
|
||||||
client: eSClient,
|
client: eSClient,
|
||||||
});
|
});
|
||||||
|
|||||||
14
package-lock.json
generated
14
package-lock.json
generated
@@ -23,7 +23,7 @@
|
|||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
"delay": "^5.0.0",
|
"delay": "^5.0.0",
|
||||||
"dotenv": "^10.0.0",
|
"dotenv": "^10.0.0",
|
||||||
"filename-parser": "^1.0.1",
|
"filename-parser": "^1.0.4",
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
"imghash": "^0.0.9",
|
"imghash": "^0.0.9",
|
||||||
"ioredis": "^4.28.1",
|
"ioredis": "^4.28.1",
|
||||||
@@ -4701,9 +4701,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/filename-parser": {
|
"node_modules/filename-parser": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/filename-parser/-/filename-parser-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/filename-parser/-/filename-parser-1.0.4.tgz",
|
||||||
"integrity": "sha512-MMzuklXc1r4N6uQXg8CQYxoiTX7w6QPeJE73L5lCTSoNR7CftCXHIA6tyINomkvWIUanrlqTB629DyTIqCucEA==",
|
"integrity": "sha512-r/cFGGlCFaz2taSlDzOtVWO66WvqPDBv6CtyqKw4GCP7+V3r5D5J0ci3fnYaDm5/GkqWL5aGA6JTbu8e+oKQMA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"compromise": "^13.11.4",
|
"compromise": "^13.11.4",
|
||||||
"compromise-dates": "^2.2.1",
|
"compromise-dates": "^2.2.1",
|
||||||
@@ -15795,9 +15795,9 @@
|
|||||||
"integrity": "sha512-uzk64HRpUZyTGZtVuvrjP0FYxzQrBf4rojot6J65YMEbwBLB0CWm0CLojVpwpmFmxcE/lkvYICgfcGozbBq6rw=="
|
"integrity": "sha512-uzk64HRpUZyTGZtVuvrjP0FYxzQrBf4rojot6J65YMEbwBLB0CWm0CLojVpwpmFmxcE/lkvYICgfcGozbBq6rw=="
|
||||||
},
|
},
|
||||||
"filename-parser": {
|
"filename-parser": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/filename-parser/-/filename-parser-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/filename-parser/-/filename-parser-1.0.4.tgz",
|
||||||
"integrity": "sha512-MMzuklXc1r4N6uQXg8CQYxoiTX7w6QPeJE73L5lCTSoNR7CftCXHIA6tyINomkvWIUanrlqTB629DyTIqCucEA==",
|
"integrity": "sha512-r/cFGGlCFaz2taSlDzOtVWO66WvqPDBv6CtyqKw4GCP7+V3r5D5J0ci3fnYaDm5/GkqWL5aGA6JTbu8e+oKQMA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"compromise": "^13.11.4",
|
"compromise": "^13.11.4",
|
||||||
"compromise-dates": "^2.2.1",
|
"compromise-dates": "^2.2.1",
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
"delay": "^5.0.0",
|
"delay": "^5.0.0",
|
||||||
"dotenv": "^10.0.0",
|
"dotenv": "^10.0.0",
|
||||||
"filename-parser": "^1.0.1",
|
"filename-parser": "^1.0.4",
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
"imghash": "^0.0.9",
|
"imghash": "^0.0.9",
|
||||||
"ioredis": "^4.28.1",
|
"ioredis": "^4.28.1",
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ export default class ApiService extends Service {
|
|||||||
await broker.call("library.walkFolders", {
|
await broker.call("library.walkFolders", {
|
||||||
basePathToWalk: path,
|
basePathToWalk: path,
|
||||||
});
|
});
|
||||||
await this.broker.call("library.processImport", {
|
await this.broker.call("queue.processImport", {
|
||||||
fileObject: {
|
fileObject: {
|
||||||
filePath: walkedFolder[0].filePath,
|
filePath: walkedFolder[0].filePath,
|
||||||
fileSize: walkedFolder[0].fileSize,
|
fileSize: walkedFolder[0].fileSize,
|
||||||
|
|||||||
@@ -152,11 +152,14 @@ export default class ImportService extends Service {
|
|||||||
async handler(
|
async handler(
|
||||||
ctx: Context<{
|
ctx: Context<{
|
||||||
sourcedMetadata: {
|
sourcedMetadata: {
|
||||||
comicvine: {
|
comicvine?: {
|
||||||
volume: { api_detail_url: string };
|
volume: { api_detail_url: string };
|
||||||
volumeInformation: {};
|
volumeInformation: {};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
inferredMetadata: {
|
||||||
|
issue: Object,
|
||||||
|
},
|
||||||
rawFileDetails: {
|
rawFileDetails: {
|
||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
@@ -164,6 +167,8 @@ export default class ImportService extends Service {
|
|||||||
) {
|
) {
|
||||||
let volumeDetails;
|
let volumeDetails;
|
||||||
const comicMetadata = ctx.params;
|
const comicMetadata = ctx.params;
|
||||||
|
|
||||||
|
// When an issue is added from the search CV feature
|
||||||
if (
|
if (
|
||||||
comicMetadata.sourcedMetadata.comicvine &&
|
comicMetadata.sourcedMetadata.comicvine &&
|
||||||
!isNil(
|
!isNil(
|
||||||
@@ -186,11 +191,13 @@ export default class ImportService extends Service {
|
|||||||
if (data) {
|
if (data) {
|
||||||
resolve(data);
|
resolve(data);
|
||||||
} else if (error) {
|
} else if (error) {
|
||||||
|
console.log("data", data);
|
||||||
|
console.log("error", error)
|
||||||
throw new Errors.MoleculerError(
|
throw new Errors.MoleculerError(
|
||||||
"Failed to import comic book",
|
"Failed to import comic book",
|
||||||
400,
|
400,
|
||||||
"IMS_FAILED_COMIC_BOOK_IMPORT",
|
"IMS_FAILED_COMIC_BOOK_IMPORT",
|
||||||
data
|
error
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -411,12 +418,6 @@ export default class ImportService extends Service {
|
|||||||
elasticSearchQuery = {
|
elasticSearchQuery = {
|
||||||
bool: {
|
bool: {
|
||||||
must: [
|
must: [
|
||||||
// {
|
|
||||||
// match_phrase: {
|
|
||||||
// "rawFileDetails.name":
|
|
||||||
// queryObject.issueName,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
match_phrase: {
|
match_phrase: {
|
||||||
"rawFileDetails.name":
|
"rawFileDetails.name":
|
||||||
|
|||||||
@@ -152,35 +152,6 @@ export default class QueueService extends Service {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.getQueue("issue.findMatchesInLibrary").on(
|
|
||||||
"failed",
|
|
||||||
async (job, error) => {
|
|
||||||
console.error(
|
|
||||||
`An error occured in 'issue.findMatchesInLibrary' queue on job id '${job.id}': ${error.message}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
await this.getQueue("issue.findMatchesInLibrary").on(
|
|
||||||
"completed",
|
|
||||||
async (job, res) => {
|
|
||||||
client.emit("action", {
|
|
||||||
type: "CV_ISSUES_FOR_VOLUME_IN_LIBRARY_UPDATED",
|
|
||||||
result: res,
|
|
||||||
});
|
|
||||||
console.info(
|
|
||||||
`Job with the id '${job.id}' completed.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
await this.getQueue("issue.findMatchesInLibrary").on(
|
|
||||||
"stalled",
|
|
||||||
async (job) => {
|
|
||||||
console.warn(
|
|
||||||
`The job with the id '${job} got stalled!`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -59,31 +59,6 @@ export default class SettingsService extends Service {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return body.responses;
|
return body.responses;
|
||||||
|
|
||||||
// return Comic.esSearch({
|
|
||||||
// query: elasticSearchQuery,
|
|
||||||
// }).then(function (results) {
|
|
||||||
// // results here
|
|
||||||
// const foo = results.body.hits.hits.map(
|
|
||||||
// (hit) => {
|
|
||||||
// const parsedFilename = refineQuery(
|
|
||||||
// hit._source.rawFileDetails.name
|
|
||||||
// );
|
|
||||||
// if (
|
|
||||||
// parsedFilename.searchParams
|
|
||||||
// .searchTerms.number ===
|
|
||||||
// parseInt(
|
|
||||||
// ctx.params.queryObject
|
|
||||||
// .issueNumber,
|
|
||||||
// 10
|
|
||||||
// )
|
|
||||||
// ) {
|
|
||||||
// return hit;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// return filter(foo, null);
|
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2634,10 +2634,10 @@
|
|||||||
"resolved" "https://registry.npmjs.org/file-type/-/file-type-10.11.0.tgz"
|
"resolved" "https://registry.npmjs.org/file-type/-/file-type-10.11.0.tgz"
|
||||||
"version" "10.11.0"
|
"version" "10.11.0"
|
||||||
|
|
||||||
"filename-parser@^1.0.1":
|
"filename-parser@^1.0.4":
|
||||||
"integrity" "sha512-MMzuklXc1r4N6uQXg8CQYxoiTX7w6QPeJE73L5lCTSoNR7CftCXHIA6tyINomkvWIUanrlqTB629DyTIqCucEA=="
|
"integrity" "sha512-r/cFGGlCFaz2taSlDzOtVWO66WvqPDBv6CtyqKw4GCP7+V3r5D5J0ci3fnYaDm5/GkqWL5aGA6JTbu8e+oKQMA=="
|
||||||
"resolved" "https://registry.npmjs.org/filename-parser/-/filename-parser-1.0.1.tgz"
|
"resolved" "https://registry.npmjs.org/filename-parser/-/filename-parser-1.0.4.tgz"
|
||||||
"version" "1.0.1"
|
"version" "1.0.4"
|
||||||
dependencies:
|
dependencies:
|
||||||
"compromise" "^13.11.4"
|
"compromise" "^13.11.4"
|
||||||
"compromise-dates" "^2.2.1"
|
"compromise-dates" "^2.2.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user