🔧 Cleaned up unused code and bumped filename-parser
This commit is contained in:
@@ -145,7 +145,7 @@ export default class ApiService extends Service {
|
||||
await broker.call("library.walkFolders", {
|
||||
basePathToWalk: path,
|
||||
});
|
||||
await this.broker.call("library.processImport", {
|
||||
await this.broker.call("queue.processImport", {
|
||||
fileObject: {
|
||||
filePath: walkedFolder[0].filePath,
|
||||
fileSize: walkedFolder[0].fileSize,
|
||||
|
||||
@@ -152,11 +152,14 @@ export default class ImportService extends Service {
|
||||
async handler(
|
||||
ctx: Context<{
|
||||
sourcedMetadata: {
|
||||
comicvine: {
|
||||
comicvine?: {
|
||||
volume: { api_detail_url: string };
|
||||
volumeInformation: {};
|
||||
};
|
||||
};
|
||||
inferredMetadata: {
|
||||
issue: Object,
|
||||
},
|
||||
rawFileDetails: {
|
||||
name: string;
|
||||
};
|
||||
@@ -164,6 +167,8 @@ export default class ImportService extends Service {
|
||||
) {
|
||||
let volumeDetails;
|
||||
const comicMetadata = ctx.params;
|
||||
|
||||
// When an issue is added from the search CV feature
|
||||
if (
|
||||
comicMetadata.sourcedMetadata.comicvine &&
|
||||
!isNil(
|
||||
@@ -186,11 +191,13 @@ export default class ImportService extends Service {
|
||||
if (data) {
|
||||
resolve(data);
|
||||
} else if (error) {
|
||||
console.log("data", data);
|
||||
console.log("error", error)
|
||||
throw new Errors.MoleculerError(
|
||||
"Failed to import comic book",
|
||||
400,
|
||||
"IMS_FAILED_COMIC_BOOK_IMPORT",
|
||||
data
|
||||
error
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -411,12 +418,6 @@ export default class ImportService extends Service {
|
||||
elasticSearchQuery = {
|
||||
bool: {
|
||||
must: [
|
||||
// {
|
||||
// match_phrase: {
|
||||
// "rawFileDetails.name":
|
||||
// queryObject.issueName,
|
||||
// },
|
||||
// },
|
||||
{
|
||||
match_phrase: {
|
||||
"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 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);
|
||||
// });
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user