🏗️ Added a socket.io event for CV event

This commit is contained in:
2023-12-31 18:15:45 -05:00
parent 88c931f0e8
commit 395e25aa37
2 changed files with 18 additions and 4 deletions

1
.gitignore vendored
View File

@@ -67,3 +67,4 @@ typings/
dist/ dist/
.vscode .vscode
userdata userdata
.DS_Store

View File

@@ -95,7 +95,7 @@ export default class ComicVineService extends Service {
filter: `volume:${comicBookDetails.sourcedMetadata.comicvine.volumeInformation.id}`, filter: `volume:${comicBookDetails.sourcedMetadata.comicvine.volumeInformation.id}`,
}, },
headers: { headers: {
"Accept": "application/json", Accept: "application/json",
"User-Agent": "ThreeTwo", "User-Agent": "ThreeTwo",
}, },
}); });
@@ -192,7 +192,7 @@ export default class ComicVineService extends Service {
); );
const results: any = []; const results: any = [];
console.log( console.log(
"passed to fetchvolumesfromcv", "passed to fetchVolumesFromCV",
ctx.params ctx.params
); );
const volumes = await this.fetchVolumesFromCV( const volumes = await this.fetchVolumesFromCV(
@@ -254,7 +254,7 @@ export default class ComicVineService extends Service {
filter: filterString, filter: filterString,
}, },
headers: { headers: {
"Accept": "application/json", Accept: "application/json",
"User-Agent": "ThreeTwo", "User-Agent": "ThreeTwo",
}, },
}); });
@@ -315,7 +315,7 @@ export default class ComicVineService extends Service {
resources, resources,
}, },
headers: { headers: {
"Accept": "application/json", Accept: "application/json",
"User-Agent": "ThreeTwo", "User-Agent": "ThreeTwo",
}, },
}); });
@@ -335,11 +335,24 @@ export default class ComicVineService extends Service {
output.push(...data.results); output.push(...data.results);
currentPage += 1; currentPage += 1;
// Params.page = currentPage; // Params.page = currentPage;
console.log( console.log(
`Fetching results for page ${currentPage} (of ${ `Fetching results for page ${currentPage} (of ${
totalPages + 1 totalPages + 1
})...` })...`
); );
await this.broker.call("socket.broadcast", {
namespace: "/",
event: "CV_SCRAPING_STATUS",
args: [
{
message: `Fetching results for page ${currentPage} (of ${
totalPages + 1
})...`,
},
],
});
return await this.fetchVolumesFromCV( return await this.fetchVolumesFromCV(
{ {
format, format,