Compare commits

...

2 Commits

Author SHA1 Message Date
ThePendulum 53fcb6a5cd 1.49.7 2020-01-10 04:40:44 +01:00
ThePendulum 89afc5e169 Switching to logger. 2020-01-10 04:40:41 +01:00
4 changed files with 8 additions and 7 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "traxxx", "name": "traxxx",
"version": "1.49.6", "version": "1.49.7",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "traxxx", "name": "traxxx",
"version": "1.49.6", "version": "1.49.7",
"description": "All the latest porn releases in one place", "description": "All the latest porn releases in one place",
"main": "src/app.js", "main": "src/app.js",
"scripts": { "scripts": {

View File

@ -120,7 +120,7 @@ async function fetchPhoto(photoUrl, index, label, attempt = 1) {
throw new Error(`Response ${res.statusCode} not OK`); throw new Error(`Response ${res.statusCode} not OK`);
} catch (error) { } catch (error) {
console.warn(`Failed attempt ${attempt}/3 to fetch photo ${index + 1} for ${label} (${photoUrl}): ${error}`); logger.warn(`Failed attempt ${attempt}/3 to fetch photo ${index + 1} for ${label} (${photoUrl}): ${error}`);
if (attempt < 3) { if (attempt < 3) {
await Promise.delay(1000); await Promise.delay(1000);
@ -171,7 +171,7 @@ async function storePhotos(photos, {
primaryRole, // role to assign to first photo if not already in database, used mainly for avatars primaryRole, // role to assign to first photo if not already in database, used mainly for avatars
}, label) { }, label) {
if (!photos || photos.length === 0) { if (!photos || photos.length === 0) {
console.warn(`No ${role}s available for ${label}`); logger.info(`No ${role}s available for ${label}`);
return; return;
} }
@ -273,7 +273,7 @@ async function storeTrailer(trailers, {
: trailers; : trailers;
if (!trailer || !trailer.src) { if (!trailer || !trailer.src) {
console.warn(`No trailer available for ${label}`); logger.info(`No trailer available for ${label}`);
return; return;
} }

View File

@ -2,6 +2,7 @@
const config = require('config'); const config = require('config');
const logger = require('./logger');
const argv = require('./argv'); const argv = require('./argv');
const knex = require('./knex'); const knex = require('./knex');
const whereOr = require('./utils/where-or'); const whereOr = require('./utils/where-or');
@ -102,7 +103,7 @@ async function fetchSitesFromArgv() {
.leftJoin('networks', 'sites.network_id', 'networks.id'); .leftJoin('networks', 'sites.network_id', 'networks.id');
const curatedSites = await curateSites(rawSites, true); const curatedSites = await curateSites(rawSites, true);
console.log(`Found ${curatedSites.length} sites in database`); logger.info(`Found ${curatedSites.length} sites in database`);
return sitesByNetwork(curatedSites); return sitesByNetwork(curatedSites);
} }
@ -120,7 +121,7 @@ async function fetchSitesFromConfig() {
.leftJoin('networks', 'sites.network_id', 'networks.id'); .leftJoin('networks', 'sites.network_id', 'networks.id');
const curatedSites = await curateSites(rawSites, true); const curatedSites = await curateSites(rawSites, true);
console.log(`Found ${curatedSites.length} sites in database`); logger.info(`Found ${curatedSites.length} sites in database`);
return sitesByNetwork(curatedSites); return sitesByNetwork(curatedSites);
} }