Compare commits
4 Commits
master
...
airdcpp-au
| Author | SHA1 | Date | |
|---|---|---|---|
| 68907a96a2 | |||
| aff4467b8b | |||
| e7341b553d | |||
| a4ccc78fe8 |
@@ -60,7 +60,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- kafka-net
|
- kafka-net
|
||||||
ports:
|
ports:
|
||||||
- "27017:27017"
|
- "127.0.0.1:27017:27017"
|
||||||
volumes:
|
volumes:
|
||||||
- "mongodb_data:/bitnami/mongodb"
|
- "mongodb_data:/bitnami/mongodb"
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- kafka-net
|
- kafka-net
|
||||||
ports:
|
ports:
|
||||||
- "6379:6379"
|
- "127.0.0.1:6379:6379"
|
||||||
|
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
image: docker.elastic.co/elasticsearch/elasticsearch:7.16.2
|
image: docker.elastic.co/elasticsearch/elasticsearch:7.16.2
|
||||||
@@ -88,7 +88,7 @@ services:
|
|||||||
soft: -1
|
soft: -1
|
||||||
hard: -1
|
hard: -1
|
||||||
ports:
|
ports:
|
||||||
- "9200:9200"
|
- "127.0.0.1:9200:9200"
|
||||||
networks:
|
networks:
|
||||||
- kafka-net
|
- kafka-net
|
||||||
|
|
||||||
|
|||||||
1712
package-lock.json
generated
1712
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -174,7 +174,7 @@ export default class LibraryService extends Service {
|
|||||||
|
|
||||||
// Convert klaw to use a promise-based approach for better flow control
|
// Convert klaw to use a promise-based approach for better flow control
|
||||||
const files = await this.getComicFiles(
|
const files = await this.getComicFiles(
|
||||||
COMICS_DIRECTORY
|
process.env.COMICS_DIRECTORY
|
||||||
);
|
);
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
console.info(
|
console.info(
|
||||||
@@ -187,7 +187,6 @@ export default class LibraryService extends Service {
|
|||||||
path.extname(file.path)
|
path.extname(file.path)
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!comicExists) {
|
if (!comicExists) {
|
||||||
// Send the extraction job to the queue
|
// Send the extraction job to the queue
|
||||||
await this.broker.call("jobqueue.enqueue", {
|
await this.broker.call("jobqueue.enqueue", {
|
||||||
@@ -331,21 +330,51 @@ export default class LibraryService extends Service {
|
|||||||
},
|
},
|
||||||
getComicsMarkedAsWanted: {
|
getComicsMarkedAsWanted: {
|
||||||
rest: "GET /getComicsMarkedAsWanted",
|
rest: "GET /getComicsMarkedAsWanted",
|
||||||
handler: async (ctx: Context<{}>) => {
|
params: {
|
||||||
|
page: { type: "number", default: 1 },
|
||||||
|
limit: { type: "number", default: 100 },
|
||||||
|
},
|
||||||
|
handler: async (
|
||||||
|
ctx: Context<{ page: number; limit: number }>
|
||||||
|
) => {
|
||||||
|
const { page, limit } = ctx.params;
|
||||||
|
this.logger.info(
|
||||||
|
`Requesting page ${page} with limit ${limit}`
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
// Query to find comics where 'markEntireVolumeAsWanted' is true or 'issues' array is not empty
|
const options = {
|
||||||
const wantedComics = await Comic.find({
|
page,
|
||||||
wanted: { $exists: true },
|
limit,
|
||||||
$or: [
|
lean: true,
|
||||||
{ "wanted.markEntireVolumeWanted": true },
|
};
|
||||||
{ "wanted.issues": { $not: { $size: 0 } } },
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(wantedComics); // Output the found comics
|
const result = await Comic.paginate(
|
||||||
return wantedComics;
|
{
|
||||||
|
wanted: { $exists: true },
|
||||||
|
$or: [
|
||||||
|
{
|
||||||
|
"wanted.markEntireVolumeWanted":
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"wanted.issues": {
|
||||||
|
$not: { $size: 0 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
options
|
||||||
|
);
|
||||||
|
|
||||||
|
// Log the raw result from the database
|
||||||
|
this.logger.info(
|
||||||
|
"Paginate result:",
|
||||||
|
JSON.stringify(result, null, 2)
|
||||||
|
);
|
||||||
|
|
||||||
|
return result.docs; // Return just the docs array
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error finding comics:", error);
|
this.logger.error("Error finding comics:", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -122,14 +122,12 @@ export default class SocketService extends Service {
|
|||||||
params: {
|
params: {
|
||||||
query: "object",
|
query: "object",
|
||||||
config: "object",
|
config: "object",
|
||||||
|
namespace: "string",
|
||||||
},
|
},
|
||||||
async handler(ctx) {
|
async handler(ctx) {
|
||||||
console.log("a, a kanha kanha...");
|
|
||||||
|
|
||||||
const { query, config, namespace } = ctx.params;
|
const { query, config, namespace } = ctx.params;
|
||||||
const namespacedInstance = this.io.of(namespace || "/");
|
const namespacedInstance = this.io.of(namespace || "/");
|
||||||
const ADCPPSocket = new AirDCPPSocket(config);
|
const ADCPPSocket = new AirDCPPSocket(config);
|
||||||
console.log("asdas", ADCPPSocket);
|
|
||||||
try {
|
try {
|
||||||
await ADCPPSocket.connect();
|
await ADCPPSocket.connect();
|
||||||
const instance = await ADCPPSocket.post(
|
const instance = await ADCPPSocket.post(
|
||||||
@@ -146,10 +144,13 @@ export default class SocketService extends Service {
|
|||||||
await ADCPPSocket.addListener(
|
await ADCPPSocket.addListener(
|
||||||
`search`,
|
`search`,
|
||||||
`search_result_added`,
|
`search_result_added`,
|
||||||
(groupedResult) => {
|
(data) => {
|
||||||
namespacedInstance.emit(
|
namespacedInstance.emit(
|
||||||
"searchResultAdded",
|
"searchResultAdded",
|
||||||
groupedResult
|
{
|
||||||
|
groupedResult: data,
|
||||||
|
instanceId: instance.id,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
instance.id
|
instance.id
|
||||||
@@ -158,10 +159,17 @@ export default class SocketService extends Service {
|
|||||||
await ADCPPSocket.addListener(
|
await ADCPPSocket.addListener(
|
||||||
`search`,
|
`search`,
|
||||||
`search_result_updated`,
|
`search_result_updated`,
|
||||||
(updatedResult) => {
|
(data) => {
|
||||||
|
console.log({
|
||||||
|
updatedResult: data,
|
||||||
|
instanceId: instance.id,
|
||||||
|
});
|
||||||
namespacedInstance.emit(
|
namespacedInstance.emit(
|
||||||
"searchResultUpdated",
|
"searchResultUpdated",
|
||||||
updatedResult
|
{
|
||||||
|
updatedResult: data,
|
||||||
|
instanceId: instance.id,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
instance.id
|
instance.id
|
||||||
@@ -176,6 +184,9 @@ export default class SocketService extends Service {
|
|||||||
await ADCPPSocket.get(
|
await ADCPPSocket.get(
|
||||||
`search/${instance.id}`
|
`search/${instance.id}`
|
||||||
);
|
);
|
||||||
|
console.log(
|
||||||
|
JSON.stringify(currentInstance, null, 4)
|
||||||
|
);
|
||||||
// Send the instance to the client
|
// Send the instance to the client
|
||||||
await namespacedInstance.emit(
|
await namespacedInstance.emit(
|
||||||
"searchesSent",
|
"searchesSent",
|
||||||
@@ -183,6 +194,7 @@ export default class SocketService extends Service {
|
|||||||
searchInfo,
|
searchInfo,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (currentInstance.result_count === 0) {
|
if (currentInstance.result_count === 0) {
|
||||||
console.log("No more search results.");
|
console.log("No more search results.");
|
||||||
namespacedInstance.emit(
|
namespacedInstance.emit(
|
||||||
@@ -190,6 +202,7 @@ export default class SocketService extends Service {
|
|||||||
{
|
{
|
||||||
message:
|
message:
|
||||||
"No more search results.",
|
"No more search results.",
|
||||||
|
currentInstance,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -214,7 +227,7 @@ export default class SocketService extends Service {
|
|||||||
{ error }
|
{ error }
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
// await ADCPPSocket.disconnect();
|
await ADCPPSocket.disconnect();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user