Skip to content
This repository was archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
allow overrideScrapeProgress
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub <[email protected]>
  • Loading branch information
Kas-tle authored Apr 29, 2023
1 parent 45e31cb commit 4b3666e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ Optionally, create a `config.json` file in the root directory of the project. Ot
"retrySeconds": 5, // Setting to 0 will retry instantly
"retryTimes": 5, // Setting to 0 will disable retries; setting to -1 will retry indefinitely
"debug": true,
"disableSSL": false
"disableSSL": false,
"overrideScrapeProgress": false // setting this to true will ignore the scrapers internal progress tracking and scrape all non-disabled modules
}
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "enjinscraper",
"version": "1.7.0",
"version": "1.7.1",
"description": "Scrapes an Enjin site via the Enjin API",
"repository": "https://github.com/Kas-tle/EnjinScraper.git",
"author": "Joshua Castle <[email protected]",
Expand Down
4 changes: 3 additions & 1 deletion src/util/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export interface Config {
messageSubject: string;
messageBody: string;
};
overrideScrapeProgress?: boolean;
}

const defaultConfig: Config = {
Expand Down Expand Up @@ -113,7 +114,8 @@ const defaultConfig: Config = {
retrySeconds: 5,
retryTimes: 5,
debug: true,
disableSSL: false
disableSSL: false,
overrideScrapeProgress: false
};

let cachedConfig: Config | null = null;
Expand Down
9 changes: 8 additions & 1 deletion src/util/database.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const sqlite3 = require('sqlite3').verbose();
import path from 'path';
import path, { resolve } from 'path';
import { Database } from 'sqlite3';
import { TableSchema } from '../interfaces/tableschema';
import { tableSchemas } from './tables';
import { MessageType, statusMessage } from './console';
import { getConfig } from './config';

let database: any = null;

Expand Down Expand Up @@ -261,6 +262,12 @@ export async function updateRows(database: Database, table: string, whereKey: st
}

export async function isModuleScraped(database: Database, module: string): Promise<boolean> {
const config = await getConfig();

if (config.overrideScrapeProgress === true) {
return false;
}

return new Promise((resolve, reject) => {
database.get(`SELECT scraped FROM scrapers WHERE module = ? AND scraped = ?`, [module, true], (err, row) => {
if (err) {
Expand Down

0 comments on commit 4b3666e

Please sign in to comment.