Fix lint errors

This commit is contained in:
Jordan Eldredge 2019-06-09 13:36:44 -07:00
parent 4deaa41941
commit b9726d5639
11 changed files with 21 additions and 41 deletions

View file

@ -4,7 +4,6 @@ const findTweetableSkin = require("./tasks/findTweetableSkins");
const fetchInternetArchiveMetadata = require("./tasks/fetchInternetArchiveMetadata");
const path = require("path");
const Skins = require("./data/skins");
const db = require("./db");
const { spawn } = require("child_process");
@ -47,10 +46,10 @@ async function main() {
//, "--dry"
]
);
break;
console.log({ output });
console.log("Done");
break;
case "fetch-metadata":
console.log("Going to download metadata from the Internet Archive");
await fetchInternetArchiveMetadata();

View file

@ -4,31 +4,6 @@ const skins = db.get("skins");
const iaItems = db.get("internetArchiveItems");
const S3 = require("../s3");
function getFilenames(skin) {
return Array.from(new Set((skin.filePaths || []).map(p => path.basename(p))));
}
async function getAll() {
const skinRecords = await skins.find(
{ type: "CLASSIC" },
{
limit: 10,
fields: {
md5: 1,
filenames: 1,
averageColor: 1,
emails: 1,
filePaths: 1,
screenshotUrl: 1,
tweetUrl: 1,
twitterLikes: 1,
},
}
);
return skinRecords.map(getSkinRecord);
}
function getSkinRecord(skin) {
const {
md5,

View file

@ -1,7 +1,6 @@
const { approve, getStatus } = require("../../s3");
const Utils = require("../utils");
const { getFilename } = require("../info");
const TWEET_BOT_CHANNEL_ID = "445577489834704906";
async function handler(message, args) {
@ -13,9 +12,14 @@ async function handler(message, args) {
}
await approve(md5);
const tweetBotChannel = message.client.channels.get(TWEET_BOT_CHANNEL_ID);
let filename = null;
await Utils.postSkin({
md5,
title: filename => `Approved: ${filename}`,
title: f => {
// Hack to get access to the file name
filename = f;
return `Approve: ${f}`;
},
dest: tweetBotChannel
});
await tweetBotChannel.send(

View file

@ -1,6 +1,6 @@
const Utils = require("../utils");
const { getCache, getFilename } = require("../info");
const { getCache } = require("../info");
async function handler(message) {
const cache = getCache();

View file

@ -1,7 +1,6 @@
const { reject, getStatus } = require("../../s3");
const Utils = require("../utils");
const { getFilename } = require("../info");
const TWEET_BOT_CHANNEL_ID = "445577489834704906";
async function handler(message, args) {
@ -13,9 +12,14 @@ async function handler(message, args) {
}
await reject(md5);
const tweetBotChannel = message.client.channels.get(TWEET_BOT_CHANNEL_ID);
let filename = null;
await Utils.postSkin({
md5,
title: filename => `Rejected: ${filename}`,
title: f => {
// Hack to get access to the file name
filename = f;
return `Rejected: ${f}`;
},
dest: tweetBotChannel
});
await tweetBotChannel.send(

View file

@ -1,6 +1,5 @@
const { getSkinToReview } = require("../../s3");
const Utils = require("../utils");
const Skins = require("../../data/skins");
async function reviewSkin(message) {
const { md5 } = await getSkinToReview();

View file

@ -1,11 +1,12 @@
const Discord = require("discord.js");
// eslint-disable-next-line
const temp = require("temp").track();
const fs = require("fs");
const fetch = require("node-fetch");
const md5Buffer = require("md5");
const Shooter = require("../../shooter");
async function handler(message, args) {
async function handler(message) {
console.log("Trying to take a screenshot");
const { attachments } = message;
if (attachments.length < 1) {

View file

@ -1,4 +1,3 @@
const { getFilename } = require("../info");
const Utils = require("../utils");
async function handler(message, args) {
const [md5] = args;

View file

@ -1,8 +1,7 @@
const Discord = require("discord.js");
const rgbHex = require("rgb-hex");
const Skins = require("../data/skins");
const { getInfo, getFilename } = require("./info");
const { approve, reject, getStatus } = require("./s3");
const { approve, reject } = require("./s3");
const filter = reaction => {
return ["👍", "👎"].some(name => reaction.emoji.name === name);

View file

@ -1,5 +1,4 @@
const express = require("express");
const path = require("path");
const app = express();
const db = require("./db");
const iaItems = db.get("internetArchiveItems");
@ -71,6 +70,7 @@ app.listen(port, () => console.log(`Example app listening on port ${port}!`));
async function main() {
return;
/*
const found = 0;
const bulkUpdates = Object.values(info)
.map((skin, i, collection) => {
@ -94,6 +94,7 @@ async function main() {
.filter(Boolean);
await skins.bulkWrite(bulkUpdates);
console.log("done");
*/
}
main();

View file

@ -34,12 +34,11 @@ async function fetchAllMetadata(limit) {
// https://archive.org/advancedsearch.php?q=collection%3Awinampskins&fl%5B%5D=identifier&rows=100000&page=1&output=json
module.exports = async function main() {
let delay = 60000;
let timeout = null;
async function go() {
console.log("Gonna fetch some more");
try {
const count = await fetchAllMetadata(500);
if(count < 1) {
if (count < 1) {
console.log("Done.");
return;
}
@ -48,7 +47,7 @@ module.exports = async function main() {
delay += 60000;
}
console.log("Scheduling another", delay / 1000);
timeout = setTimeout(go, delay);
setTimeout(go, delay);
}
go();