add console.logs for download URLs as configuration option

This commit is contained in:
kSlide 2021-08-06 06:06:50 +00:00 committed by Bill
parent 32435a3c84
commit 476b0762d4
9 changed files with 47 additions and 1 deletions

View File

@ -18,4 +18,5 @@
"convert.effect": "1", "convert.effect": "1",
"convert.furniture": "1", "convert.furniture": "1",
"convert.pet": "1" "convert.pet": "1"
"misc.log_download_urls": "0"
} }

View File

@ -63,6 +63,10 @@ export class EffectDownloader
if(!url || !url.length) return null; if(!url || !url.length) return null;
const logDownloads = this._configuration.getBoolean('misc.log_download_urls');
if(logDownloads) console.log(`<Downloader> Downloading effect map from ${url}`);
const content = await FileUtilities.readFileAsString(url); const content = await FileUtilities.readFileAsString(url);
if(!content || !content.length) return null; if(!content || !content.length) return null;
@ -78,6 +82,10 @@ export class EffectDownloader
url = url.replace('%className%', className); url = url.replace('%className%', className);
const logDownloads = this._configuration.getBoolean('misc.log_download_urls');
if(logDownloads) console.log(`<Downloader> Downloading effect from ${url}`);
const buffer = await FileUtilities.readFileAsBuffer(url); const buffer = await FileUtilities.readFileAsBuffer(url);
if(!buffer) return; if(!buffer) return;

View File

@ -23,6 +23,10 @@ export class EffectMapDownloader
if(!url || !url.length) return null; if(!url || !url.length) return null;
const logDownloads = this._configuration.getBoolean('misc.log_download_urls');
if(logDownloads) console.log(`<Downloader> Downloading effect map from ${url}`);
const content = await FileUtilities.readFileAsString(url); const content = await FileUtilities.readFileAsString(url);
if(!content || !content.length) return null; if(!content || !content.length) return null;

View File

@ -23,6 +23,10 @@ export class ExternalTextsDownloader
if(!url || !url.length) return null; if(!url || !url.length) return null;
const logDownloads = this._configuration.getBoolean('misc.log_download_urls');
if(logDownloads) console.log(`<Downloader> Downloading external texts from ${url}`);
const content = await FileUtilities.readFileAsString(url); const content = await FileUtilities.readFileAsString(url);
if(!content || !content.length) return null; if(!content || !content.length) return null;

View File

@ -65,6 +65,10 @@ export class FigureDownloader
if(!url || !url.length) return null; if(!url || !url.length) return null;
const logDownloads = this._configuration.getBoolean('misc.log_download_urls');
if(logDownloads) console.log(`<Downloader> Downloading figure data from ${url}`);
const content = await FileUtilities.readFileAsString(url); const content = await FileUtilities.readFileAsString(url);
if(!content || !content.length) return null; if(!content || !content.length) return null;
@ -80,6 +84,10 @@ export class FigureDownloader
url = url.replace('%className%', className); url = url.replace('%className%', className);
const logDownloads = this._configuration.getBoolean('misc.log_download_urls');
if(logDownloads) console.log(`<Downloader> Downloading figure from ${url}`);
const buffer = await FileUtilities.readFileAsBuffer(url); const buffer = await FileUtilities.readFileAsBuffer(url);
if(!buffer) return; if(!buffer) return;

View File

@ -23,6 +23,10 @@ export class FigureMapDownloader
if(!url || !url.length) return null; if(!url || !url.length) return null;
const logDownloads = this._configuration.getBoolean('misc.log_download_urls');
if(logDownloads) console.log(`<Downloader> Downloading figure map from ${url}`);
const content = await FileUtilities.readFileAsString(url); const content = await FileUtilities.readFileAsString(url);
if(!content || !content.length) return null; if(!content || !content.length) return null;

View File

@ -104,6 +104,10 @@ export class FurnitureDownloader
if(!url || !url.length) return null; if(!url || !url.length) return null;
const logDownloads = this._configuration.getBoolean('misc.log_download_urls');
if(logDownloads) console.log(`<Downloader> Downloading furniture data from ${url}`);
const content = await FileUtilities.readFileAsString(url); const content = await FileUtilities.readFileAsString(url);
if(!content || !content.length) return null; if(!content || !content.length) return null;
@ -120,6 +124,10 @@ export class FurnitureDownloader
url = url.replace('%revision%', revision.toString()); url = url.replace('%revision%', revision.toString());
url = url.replace('%className%', className); url = url.replace('%className%', className);
const logDownloads = this._configuration.getBoolean('misc.log_download_urls');
if(logDownloads) console.log(`<Downloader> Downloading furniture from ${url}`);
const buffer = await FileUtilities.readFileAsBuffer(url); const buffer = await FileUtilities.readFileAsBuffer(url);
if(!buffer) return; if(!buffer) return;

View File

@ -6,7 +6,8 @@ import { FileUtilities } from '../../utils/FileUtilities';
export class FurnitureDataDownloader export class FurnitureDataDownloader
{ {
constructor(private readonly _configuration: Configuration) constructor(private readonly _configuration: Configuration)
{} {
}
public async download(callback: (content: string) => Promise<void>): Promise<void> public async download(callback: (content: string) => Promise<void>): Promise<void>
{ {
@ -23,6 +24,10 @@ export class FurnitureDataDownloader
if(!url || !url.length) return null; if(!url || !url.length) return null;
const logDownloads = this._configuration.getBoolean('misc.log_download_urls');
if(logDownloads) console.log(`<Downloader> Downloading furniture data from ${url}`);
const content = await FileUtilities.readFileAsString(url); const content = await FileUtilities.readFileAsString(url);
if(!content || !content.length) return null; if(!content || !content.length) return null;

View File

@ -23,6 +23,10 @@ export class ProductDataDownloader
if(!url || !url.length) return null; if(!url || !url.length) return null;
const logDownloads = this._configuration.getBoolean('misc.log_download_urls');
if(logDownloads) console.log(`<Downloader> Downloading product data from ${url}`);
const content = await FileUtilities.readFileAsString(url); const content = await FileUtilities.readFileAsString(url);
if(!content || !content.length) return null; if(!content || !content.length) return null;