From ed022f7a55b7e5b43122148a33d9b4661f1df2bc Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Mon, 9 Dec 2024 15:15:27 -0500 Subject: [PATCH] Generate done. --- default.env | 3 +- dist/db/index.js | 70 ++++++++++++++++- dist/db/index.js.map | 2 +- dist/files3/index.js.map | 2 +- dist/generate.js | 122 +++++++++++++++++++++++++++-- dist/generate.js.map | 2 +- dist/geocode/index.js | 74 ++++++++++++++++++ dist/geocode/index.js.map | 1 + dist/shell/index.js | 6 +- dist/shell/index.js.map | 2 +- notes/exif_test.jpg | Bin 0 -> 30452 bytes notes/exif_test.sh | 3 + notes/exif_test.txt | 7 ++ notes/exit_test.txt | 8 -- package-lock.json | 158 ++++++++++++++++++++++++++++++++------ package.json | 7 +- scripts/all.sh | 4 +- scripts/generate.sh | 1 + scripts/img.sh | 6 +- sql/setup.sql | 11 ++- src/db/index.ts | 41 +++++++++- src/generate.ts | 78 ++++++++++++++++--- src/geocode/index.ts | 89 +++++++++++++++++++++ src/shell/index.ts | 6 +- 24 files changed, 632 insertions(+), 71 deletions(-) create mode 100644 dist/geocode/index.js create mode 100644 dist/geocode/index.js.map create mode 100644 notes/exif_test.jpg create mode 100644 notes/exif_test.sh create mode 100644 notes/exif_test.txt delete mode 100644 notes/exit_test.txt create mode 100644 src/geocode/index.ts diff --git a/default.env b/default.env index f958371..4a2a988 100644 --- a/default.env +++ b/default.env @@ -8,4 +8,5 @@ S3_BUCKET="" S3_ENDPOINT="" UMAMI="" DB="data/site.db" -ARTIST="Unknown" \ No newline at end of file +ARTIST="Unknown" +GEOCODE_API_KEY="" \ No newline at end of file diff --git a/dist/db/index.js b/dist/db/index.js index fd84826..8b858ac 100644 --- a/dist/db/index.js +++ b/dist/db/index.js @@ -9,7 +9,7 @@ class DB { constructor() { this.log = (0, log_1.createLog)('db'); this.db = new sqlite3_1.Database((0, env_1.envString)('DB', 'data/site.db')); - this.db.run('PRAGMA journal_mode = WAL;'); + //this.db.run( 'PRAGMA journal_mode = WAL;'); } async run(query, args = null) { return new Promise((resolve, reject) => { @@ -20,6 +20,15 @@ class DB { }); }); } + async all(query, args = null) { + return new Promise((resolve, reject) => { + return this.db.all(query, args, (err, rows) => { + if (err) + return reject(err); + return resolve(rows); + }); + }); + } toBoolean(val) { return val === 1 ? true : false; } @@ -41,12 +50,69 @@ class DB { } try { await this.run(query, values); - this.log.info(`Inserted new photo`); + this.log.info(`Inserted new photo ${photo.name}`); } catch (err) { throw err; } } + async existsName(name) { + const query = `SELECT id FROM photos WHERE name = ? LIMIT 1;`; + let rows = []; + let exists = false; + try { + rows = await this.all(query, [name]); + } + catch (err) { + this.log.error(`Error finding photo by name ${name}`, err); + } + if (rows.length > 0) { + exists = true; + } + return exists; + } + async existsHash(hash) { + const query = `SELECT id FROM photos WHERE hash = ? LIMIT 1;`; + let rows = []; + let exists = false; + try { + rows = await this.all(query, [hash]); + } + catch (err) { + this.log.error(`Error finding photo by hash ${hash}`, err); + } + if (rows.length > 0) { + exists = true; + } + return exists; + } + async cacheLocation(location, latlng) { + const query = `INSERT OR IGNORE INTO geocode (location, latitude, longitude) VALUES (?, ?, ?);`; + try { + await this.run(query, [location, latlng.latitude, latlng.longitude]); + } + catch (err) { + //ignore + } + } + async getLocation(location) { + const query = `SELECT latitude, longitude FROM geocode WHERE location = ? LIMIT 1;`; + let rows = []; + let res = null; + try { + rows = await this.all(query, [location]); + } + catch (err) { + //ignore + } + if (rows.length > 0) { + res = { + latitude: rows[0].latitude, + longitude: rows[0].longitude + }; + } + return res; + } } exports.DB = DB; module.exports = { DB }; diff --git a/dist/db/index.js.map b/dist/db/index.js.map index 352d680..934af27 100644 --- a/dist/db/index.js.map +++ b/dist/db/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AAEvB,gCAAmC;AAEnC,qCAAmC;AACnC,gCAAmC;AAmBnC,MAAa,EAAE;IAId;QACC,IAAI,CAAC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dist/files3/index.js.map b/dist/files3/index.js.map index 2220300..ce1f99c 100644 --- a/dist/files3/index.js.map +++ b/dist/files3/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/files3/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACZ,yBAAuB;AAEvB,+BAAkC;AAClC,+BAAkD;AAClD,0CAA0D;AAC1D,2BAAqC;AACrC,mCAAoC;AACpC,iDAAmC;AACnC,qCAAuC;AACvC,2BAA4B;AAC5B,6CAA8C;AAE9C,gCAAmC;AAEnC,gCAAmC;AAEnC,MAAM,OAAO,GAAG,CAAC,IAAA,eAAS,EAAC,WAAW,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,eAAS,EAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAA,eAAS,EAAC,SAAS,EAAE,IAAA,WAAM,GAAE,CAAC,CAAC;AAc1H,MAAa,MAAM;IAQf;;;OAGG;IAEH,YAAa,MAAe,EAAE,YAAsB,IAAI;QAZhD,cAAS,GAAa,KAAK,CAAC;QAatC,MAAM,WAAW,GAAY,IAAA,eAAS,EAAC,aAAa,EAAE,uBAAuB,CAAC,CAAC;QAC/E,MAAM,cAAc,GAAc,IAAI,kBAAQ,CAAC,WAAW,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG;YACb,WAAW,EAAG,IAAA,eAAS,EAAC,eAAe,EAAE,kBAAkB,CAAC;YAC5D,eAAe,EAAG,IAAA,eAAS,EAAC,kBAAkB,EAAE,sBAAsB,CAAC;YACvE,QAAQ,EAAE,cAAmC;YAC7C,gBAAgB,EAAE,IAAI;SACzB,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC;QAC5B,IAAI,CAAC,EAAE,GAAI,IAAI,YAAE,CAAC,QAAQ,CAAC,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG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MAAM,EAAE,CAAC,GAAW,EAAE,IAAU,EAAE,EAAE;gBAC7D,IAAI,GAAG,EAAE,CAAC;oBACN,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;oBAC5B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;gBACvB,CAAC;gBACD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;YACzB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,KAAK,CAAC,MAAM;QACf,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO,KAAK,CAAC;IACtC,CAAC;CACJ;AA5dD,wBA4dC;AAGD,MAAM,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/generate.js b/dist/generate.js index 3db81ec..c987032 100644 --- a/dist/generate.js +++ b/dist/generate.js @@ -1,25 +1,43 @@ "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); require("dotenv/config"); const log_1 = require("./log"); const promises_1 = require("fs/promises"); const path_1 = require("path"); const util_1 = require("util"); +const uuid_1 = require("uuid"); +const crypto_1 = require("crypto"); +const os_1 = require("os"); +const moment_1 = __importDefault(require("moment")); +const argparse_1 = require("argparse"); const shell_1 = require("./shell"); const hash_1 = require("./hash"); const files3_1 = require("./files3"); const env_1 = require("./env"); const db_1 = require("./db"); +const geocode_1 = require("./geocode"); const sizeOf = (0, util_1.promisify)(require('image-size')); class Generate { constructor() { this.inbox = (0, env_1.envString)('INBOX', '~/Photos/toprocess'); this.photos = (0, env_1.envString)('PHOTOS', '~/Photos/processed'); + this.artist = (0, env_1.envString)('ARTIST', 'Unknown'); + this.tmp = (0, os_1.tmpdir)(); this.log = (0, log_1.createLog)('generate'); + const parser = new argparse_1.ArgumentParser({ + description: 'Generate script' + }); + parser.add_argument('-s', '--score', { type: 'int', default: 0, help: 'Starting score' }); + const args = parser.parse_args(); this.log.info(`Generating site: ${new Date()}`); this.db = new db_1.DB(); - this.s3 = new files3_1.Files3((0, env_1.envString)('S3_BUCKET', 'mmcwilliamsphotos'), true); + this.s3 = new files3_1.Files3((0, env_1.envString)('S3_BUCKET', 's3bucket'), true); + this.geocode = new geocode_1.Geocode(); this.generate(); + this.score = args.score; } async generate() { //check version @@ -33,6 +51,7 @@ class Generate { let filename; let meta; let photo; + let exif; try { inbox = await (0, promises_1.realpath)(this.inbox); } @@ -74,6 +93,19 @@ class Generate { this.log.error(`Error creating photo record metadata`, err); continue; } + if (await this.db.existsName(filename)) { + this.log.info(`Image ${filename} already exists`); + if (await this.db.existsHash(photo.hash)) { + this.log.warn(`Image ${name} already exists, moving...`); + await this.move(image); + continue; + } + } + if (await this.db.existsHash(photo.hash)) { + this.log.warn(`Image exists under different name, update?`); + await this.move(image); + continue; + } try { await this.db.create(photo); } @@ -88,11 +120,56 @@ class Generate { this.log.error(`Error uploading image`, err); continue; } - //await this.move(image); + try { + exif = await this.exif(photo); + } + catch (err) { + this.log.error(`Error building EXIF data`, err); + } + try { + await this.img(image, photo.id, exif); + } + catch (err) { + this.log.error(`Error running img.sh script`, err); + } + await this.move(image); } } - async img(file, exif) { - const cmd = ['bash', 'scripts/img.sh', file, exif]; + //Artist string + //ImageTitle string + //ImageUniqueID string + //ISO int16u[n] + //DateTimeOriginal string (YYYY:MM:DD HH:MM:SS) + // + //GPSLatitude rational64u[3] + //GPSLongitude + async exif(photo) { + const filePath = await this.mktemp('photosite_exif'); + const created = moment_1.default.unix(photo.created / 1000).format('YYYY:MM:DD HH:mm:ss'); + let exif = `-Artist=${this.artist} +-ImageTitle=${photo.name} +-ImageUniqueId=${photo.id} +-DateTimeOriginal=${created}`; + const iso = photo.filmstock.split(' ').filter(el => this.isOnlyNumbers(el)).map(el => parseInt(el)).filter(el => el > 25); + if (iso.length > 0) { + exif += ` +-ISO=${iso}`; + } + if (photo.latitude !== null && photo.longitude !== null) { + exif += ` +-GPSLatitude=${photo.latitude} +-GPSLongitude=${photo.longitude}`; + } + try { + await (0, promises_1.writeFile)(filePath, exif, 'utf8'); + } + catch (err) { + this.log.error(`Error writing EXIF data`, err); + } + return filePath; + } + async img(file, id, exif) { + const cmd = ['bash', 'scripts/img.sh', file, id, exif]; const shell = new shell_1.Shell(cmd); try { await shell.execute(); @@ -166,7 +243,9 @@ class Generate { const hash = await hash_1.Hashes.fileHash(image); const dimensions = await this.getImageDimensions(image); const now = Date.now(); + const latlng = await this.geocode.query(meta.location); return { + id: (0, uuid_1.v4)(), name: (0, path_1.basename)(image), original: meta.original, hash, @@ -175,15 +254,48 @@ class Generate { format: meta.format, filmstock: meta.filmstock, location: meta.location, + latitude: latlng === null ? null : latlng.latitude, + longitude: latlng === null ? null : latlng.longitude, discovered: now, updated: now, - created: +new Date(meta.year, meta.month, meta.day) + created: +new Date(meta.year, meta.month, meta.day), + score: this.score }; } async upload(image) { const name = (0, path_1.basename)(image); return this.s3.createFromPath(image, name); } + async move(image) { + const name = (0, path_1.basename)(image); + const dest = (0, path_1.join)(this.photos, name); + try { + //await rename(image, dest); + this.log.info(`Moved image ${name} to outbox`); + } + catch (err) { + this.log.error(`Error moving image`, err); + } + } + async mktemp(prefix = 'tmp') { + const uniqueId = (0, crypto_1.randomBytes)(16).toString('hex'); + const tempFilePath = (0, path_1.join)(this.tmp, `${prefix}-${uniqueId}`); + try { + await (0, promises_1.writeFile)(tempFilePath, '', { flag: 'wx' }); + return tempFilePath; + } + catch (err) { + if (err.code === 'EEXIST') { + return this.mktemp(prefix); + } + else { + throw err; + } + } + } + isOnlyNumbers(str) { + return /^[0-9]+$/.test(str); + } } new Generate(); //# sourceMappingURL=generate.js.map \ No newline at end of file diff --git a/dist/generate.js.map b/dist/generate.js.map index 30acea0..4bea359 100644 --- a/dist/generate.js.map +++ b/dist/generate.js.map @@ -1 +1 @@ -{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate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geocode/index.js new file mode 100644 index 0000000..42ab42d --- /dev/null +++ b/dist/geocode/index.js @@ -0,0 +1,74 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Geocode = void 0; +require("dotenv/config"); +const url_1 = require("url"); +const node_fetch_1 = __importDefault(require("node-fetch")); +const log_1 = require("../log"); +const env_1 = require("../env"); +const db_1 = require("../db"); +class Geocode { + constructor() { + this.log = (0, log_1.createLog)('geocode'); + this.baseUrl = 'https://geocode.maps.co/search'; + this.apiKey = (0, env_1.envString)('GEOCODE_API_KEY', null); + this.db = new db_1.DB(); + } + async query(location) { + let res = await this.db.getLocation(location); + if (res === null) { + res = await this.api(location); + } + return res; + } + toLatLng(obj) { + return { + latitude: parseFloat(obj.lat), + longitude: parseFloat(obj.lon) + }; + } + //https://geocode.maps.co/search?q=&api_key=675738aa38619885468998kehbf6458 + async api(location) { + const url = new url_1.URL(this.baseUrl); + let response; + let json; + let res = null; + url.searchParams.append('q', location); + this.log.info(`Querying API: ${url.href}`); + url.searchParams.append('api_key', this.apiKey); + await this.delay(1000); //rate limit to 1/sec + try { + response = await (0, node_fetch_1.default)(url.href); + } + catch (err) { + this.log.error('Error getting response', err); + return null; + } + try { + json = await response.json(); + } + catch (err) { + this.log.error('Error parsing json', err); + return null; + } + if (json.length < 1) { + return null; + } + res = this.toLatLng(json[0]); + await this.db.cacheLocation(location, res); + return res; + } + async delay(ms) { + return new Promise((resolve, reject) => { + return setTimeout(resolve, ms); + }); + } + cache(location, latitude, longitude) { + } +} +exports.Geocode = Geocode; +module.exports = { Geocode }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/geocode/index.js.map b/dist/geocode/index.js.map new file mode 100644 index 0000000..102133e --- /dev/null +++ b/dist/geocode/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/geocode/index.ts"],"names":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6424 100644 --- a/dist/shell/index.js +++ b/dist/shell/index.js @@ -24,7 +24,8 @@ class Shell { return new Promise((resolve, reject) => { this.child = (0, child_process_1.spawn)(this.bin, this.args); this.log.info(`Shell: ${this.bin} ${this.args.join(' ')}`); - this.child.stdout.on('data', (data) => { + this.child.stdout.on('data', (output) => { + const data = output.toString(); if (!this.silent) this.log.info(data); if (this.after !== null) @@ -33,7 +34,8 @@ class Shell { this.stdio(data); } }); - this.child.stderr.on('data', (data) => { + this.child.stderr.on('data', (output) => { + const data = output.toString(); if (!this.silent) this.log.warn(data); if (this.stderr !== null) { diff --git a/dist/shell/index.js.map b/dist/shell/index.js.map index c7f329f..6ab41ba 100644 --- a/dist/shell/index.js.map +++ b/dist/shell/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shell/index.ts"],"names":[],"mappings":";;;AAAA,iDAAsE;AACtE,gCAAmC;AAEnC,2BAAyB;AAEzB,MAAa,KAAK;IAWjB,YAAa,IAAY,EAAE,QAAmB,IAAI,EAAE,SAAoB,IAAI,EAAE,QAAmB,IAAI,EAAE,SAAmB,KAAK;QANvH,UAAK,GAAc,EAAE,CAAC;QACtB,UAAK,GAAc,IAAI,CAAC;QACxB,WAAM,GAAc,IAAI,CAAC;QACzB,UAAK,GAAc,IAAI,CAAC;QACxB,WAAM,GAAa,KAAK,CAAC;QAGhC,MAAM,GAAG,GAAY,IAAI,CAAC,KAAK,EAAE,CAAC;QAClC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,IAAA,eAAS,EAAC,GAAG,CAAC,CAAC;IAC3B,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G,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC7D,2BAA2B;QAC3B,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;CACD;AAjED,sBAiEC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,CAAC"} \ No newline at end of file diff --git a/notes/exif_test.jpg b/notes/exif_test.jpg new file mode 100644 index 0000000000000000000000000000000000000000..60a9e4b51867378dde7686fbc10b09bac62f852f GIT binary patch literal 30452 zcmb@tcQ{;M_cwgT=+T4dh8aXl5Mm6X_s)zi5xw^=gb{);VU!?xof$PmO$Z`-2u4YW zE!de?RK*`KraI_tB}-ZT5`v(G+%=l-sM&>CUxE&yO) z0EhqpKnYNQH~_Ls1iDNPAkP1dJwVq1@W1pVmxc1c1%PtMzwGHR?SGcv{ugGuB&EDO2BajUq!E%* z2njgkpS{H821x!t1OQYZLGD3b&X6Ft`#}&LNT9Qqvty966YyWxcp23tIdJLspE|lk zAl=Kj{~J5}!*VJA)Z{)XKvNX}{;AV{d;d>e z{YM98y$s>jWm}a0N9S7#0Py2WecFF?4!Ho(8V>+$pZ=qR6$1eMBLHX_cMJ{)`8Nl^ zahZ>RhQN+wSW3?;Ck#p~CY;iI`@(5bZ1Px5GLuld9Z$aqvZNPz4{F@sL`}WjlKA`g z?>wLekb=SgY@}dPGE!19a%u|lOQEHrrlh8)WniGErKe-O%Ervdbd8CQo`s9$8aq2D zCnp0lH!n8_FB=CZ$3IR$q-12|WaKmy6f_)+^o$(;pXF~iz(@(~0sCMOKS06=0yBdC z_5oa%4N40B?;rU;S4shZ$jC{+q?DJXS_}XQ2n;461Cx-FP>_*dmR**RF#=3{IR81*aVGb{PR&JREU?fbLypkUXp!SUM~(D{$T!>jckKb33Nqk$&a=7eFjF8KgR=dM9Hm zJ*@L^_>JuB%wk+FGBdHgclXXm#pZ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ctlk(60?=SvSrK@-F z$NTAO6Z1=_9$EO+Nk@G-;Oa4YlEmB#)wup@K>q-aw`$<(kN*H&KNl2R zryta5v7=CSr}`aso_^y?T3&1SL2G{kE@ z`pX>itk&mRS$7OD3_b|Xv!<3>Cug9RT1R!-#-2uqviuUHWPP=k2Agljv_y_4tza-@ zYREiE>hz|eriZ91>EWV?MF@y0lA{>ja7&y3GJocCvghK5SKTQgg0A~h3PZV>=>Vsa zO#c9!$AWR}20wjO@ujz&M1O*9Jj4E0oPtO^7G(BjKKgh0+o&VVXg}&d^Qn#q z9DX$07vlq6Z%0yuZ-K}of}?Ohf;;KbhFk}mZ8~H1Oxu6AeLIn^q(-?h`}}?NCrxiC zLdr2ajIjRzx=)k-@$5c1KHBJ|q*#vXWG^TF@hWXm{{V%1pU?N#ba4oggn2AUV(rOh z`8r9T*l8!J@vaI=P?aTCoGet#!Z~Dp%t`iNu>Sz3eMo*Zl|m>`I0GE%&mS5{nbIWA zn@b~0AJa=3-nr9josC2@JA!IpbHWAnNBH?4-(4D7&1_>_uQN=g98{_ig0aBLPyYZB z?fYw)HY9bi!4H!hN}wqiKcJJ5`}fq5>~Y`QI^mij4J_R6k=2?;KjLh6{{W}Px2?_& ejebb~04UPb*Ydy2{{YuZRsR6yMu= 6" } }, + "node_modules/@types/argparse": { + "version": "2.0.17", + "resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-2.0.17.tgz", + "integrity": "sha512-fueJssTf+4dW4HODshEGkIZbkLKHzgu1FvCI4cTc/MKum/534Euo3SrN+ilq8xgyHnOjtmg33/hee8iXLRg1XA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/aws-sdk2-types": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/@types/aws-sdk2-types/-/aws-sdk2-types-0.0.5.tgz", @@ -222,6 +234,17 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/moment": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/@types/moment/-/moment-2.13.0.tgz", + "integrity": "sha512-DyuyYGpV6r+4Z1bUznLi/Y7HpGn4iQ4IVcGn8zrr1P4KotKLdH0sbK1TFR6RGyX6B+G8u83wCzL+bpawKU/hdQ==", + "deprecated": "This is a stub types definition for Moment (https://github.com/moment/moment). Moment provides its own type definitions, so you don't need @types/moment installed!", + "dev": true, + "license": "MIT", + "dependencies": { + "moment": "*" + } + }, "node_modules/@types/node": { "version": "20.17.9", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.9.tgz", @@ -232,6 +255,17 @@ "undici-types": "~6.19.2" } }, + "node_modules/@types/node-fetch": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "form-data": "^4.0.0" + } + }, "node_modules/@types/s3-upload-stream": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/@types/s3-upload-stream/-/s3-upload-stream-1.0.7.tgz", @@ -741,13 +775,10 @@ } }, "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "license": "MIT", - "dependencies": { - "sprintf-js": "~1.0.2" - } + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" }, "node_modules/arr-diff": { "version": "4.0.0", @@ -823,6 +854,13 @@ "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", "license": "MIT" }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, "node_modules/atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -1254,6 +1292,19 @@ "text-hex": "1.0.x" } }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/component-emitter": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.1.tgz", @@ -1442,6 +1493,16 @@ "node": ">=0.10.0" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -1785,6 +1846,21 @@ "node": ">=0.10.0" } }, + "node_modules/form-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -3065,21 +3141,6 @@ "node": ">=0.10.0" } }, - "node_modules/mime": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/mime/-/mime-4.0.4.tgz", - "integrity": "sha512-v8yqInVjhXyqP6+Kw4fV3ZzeMRqEW6FotRsKXjRS5VMTNIuXsdRoAvklpoRgSqXm6o9VNH4/C0mgedko9DdLsQ==", - "funding": [ - "https://github.com/sponsors/broofa" - ], - "license": "MIT", - "bin": { - "mime": "bin/cli.js" - }, - "engines": { - "node": ">=16" - } - }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -3401,6 +3462,26 @@ "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", "license": "MIT" }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/node-gyp": { "version": "8.4.1", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz", @@ -3864,6 +3945,15 @@ "node": ">= 0.10.0" } }, + "node_modules/remarkable/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, "node_modules/repeat-element": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz", @@ -4837,6 +4927,12 @@ "node": ">=0.10.0" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, "node_modules/triple-beam": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz", @@ -5081,6 +5177,22 @@ "node": ">=0.10.0" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index ccc1690..8c698b1 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,13 @@ "author": "Matthew McWilliams", "license": "MIT", "devDependencies": { + "@types/argparse": "^2.0.17", "@types/handlebars-helpers": "^0.5.6", "@types/lodash": "^4.14.202", "@types/mime-types": "^2.1.4", + "@types/moment": "^2.13.0", "@types/node": "^20.10.6", + "@types/node-fetch": "^2.6.11", "@types/s3-upload-stream": "^1.0.7", "@types/sqlite3": "^3.1.11", "@types/triple-beam": "^1.3.5", @@ -30,14 +33,16 @@ }, "dependencies": { "@atproto/api": "^0.13.18", + "argparse": "^2.0.1", "aws-sdk": "^2.1692.0", "dotenv": "^16.3.1", "handlebars": "^4.7.8", "handlebars-helpers": "^0.10.0", "image-size": "^1.1.1", "lodash": "^4.17.21", - "mime": "^4.0.1", "mime-types": "^2.1.35", + "moment": "^2.30.1", + "node-fetch": "^2.7.0", "s3-cli": "^0.13.0", "s3-upload-stream": "^1.0.7", "sqlite3": "^5.1.7", diff --git a/scripts/all.sh b/scripts/all.sh index 781b07d..ffda806 100644 --- a/scripts/all.sh +++ b/scripts/all.sh @@ -2,5 +2,5 @@ set -e -node dist/generate -node dist/build \ No newline at end of file +bash scripts/generate.sh +bash scripts/build.sh \ No newline at end of file diff --git a/scripts/generate.sh b/scripts/generate.sh index 5d48982..c8f3272 100644 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -6,6 +6,7 @@ source .env rm -rf data/site.db mkdir -p data +mkdir -p www cat "sql/setup.sql" | sqlite3 "${DB}" diff --git a/scripts/img.sh b/scripts/img.sh index fadc971..03617f1 100644 --- a/scripts/img.sh +++ b/scripts/img.sh @@ -9,7 +9,7 @@ ID="${2}" EXIF="${3}" SIZES=( - "home:420" + "thumb:420" "full:2000" ) @@ -26,9 +26,7 @@ for sizeRaw in ${SIZES[@]}; do size=$(echo $sizeRaw | awk -F':' '{print $2}') name=$(basename "${1}") name=${name%.*} - output="${WWW}/img/${ID}_${size}.jpg" + output="${WWW}/img/${ID}_${sizeName}.jpg" img "${1}" "${output}" "${size}" exiftool -overwrite_original -@ "${EXIF}" "${output}" done - -mv "${1}" "${PHOTOS}/" diff --git a/sql/setup.sql b/sql/setup.sql index a598f57..39f5c86 100644 --- a/sql/setup.sql +++ b/sql/setup.sql @@ -8,6 +8,8 @@ CREATE TABLE IF NOT EXISTS photos ( format TEXT, filmstock TEXT, location TEXT, + latitude REAL, + longitude REAL, discovered INTEGER, created INTEGER, updated INTEGER, @@ -16,7 +18,8 @@ CREATE TABLE IF NOT EXISTS photos ( deleted INTEGER DEFAULT 0 ); -CREATE TABLE IF NOT EXISTS version ( - id TEXT PRIMARY KEY, - updated INTEGER UNIQUE -) \ No newline at end of file +CREATE TABLE IF NOT EXISTS geocode ( + location TEXT PRIMARY KEY, + latitude REAL, + longitude REAL +); \ No newline at end of file diff --git a/src/db/index.ts b/src/db/index.ts index 368cb7f..e9adcd5 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -5,6 +5,11 @@ import type { Logger } from 'winston'; import { Database } from 'sqlite3'; import { envString } from '../env'; +interface LatLng { + latitude : number; + longitude : number; +} + interface Photo { id : string; name : string; @@ -15,6 +20,8 @@ interface Photo { format? : string; filmstock? : string; location? : string; + latitude? : number; + longitude? : number; discovered ? : number; created? : number; updated? : number; @@ -30,7 +37,7 @@ export class DB { constructor () { this.log = createLog('db'); this.db = new Database(envString('DB', 'data/site.db')); - this.db.run( 'PRAGMA journal_mode = WAL;'); + //this.db.run( 'PRAGMA journal_mode = WAL;'); } private async run (query : string, args : any[] = null) { @@ -109,7 +116,37 @@ export class DB { return exists; } + public async cacheLocation (location : string, latlng : LatLng) { + const query : string = `INSERT OR IGNORE INTO geocode (location, latitude, longitude) VALUES (?, ?, ?);`; + try { + await this.run(query, [location, latlng.latitude, latlng.longitude]); + } catch (err) { + //ignore + } + } + + public async getLocation (location : string) : Promise { + const query : string = `SELECT latitude, longitude FROM geocode WHERE location = ? LIMIT 1;`; + let rows : any[] = []; + let res : LatLng = null; + try { + rows = await this.all(query, [location]); + } catch (err) { + //ignore + } + + if (rows.length > 0) { + res = { + latitude : rows[0].latitude, + longitude : rows[0].longitude + } + } + + return res; + + } + } module.exports = { DB }; -export type { Photo }; \ No newline at end of file +export type { Photo, LatLng }; \ No newline at end of file diff --git a/src/generate.ts b/src/generate.ts index bc24624..0f42d4c 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -7,12 +7,15 @@ import { promisify } from 'util'; import { v4 as uuid } from 'uuid'; import { randomBytes } from 'crypto'; import { tmpdir } from 'os'; +import moment from 'moment'; +import { ArgumentParser } from 'argparse'; import { Shell } from './shell'; import { Hashes } from './hash'; import { Files3 } from './files3' import { envString } from './env'; import { DB } from './db'; -import type { Photo } from './db'; +import type { Photo, LatLng } from './db'; +import { Geocode } from './geocode'; const sizeOf = promisify(require('image-size')); @@ -35,14 +38,24 @@ class Generate { private artist : string = envString('ARTIST', 'Unknown'); private s3 : Files3; private db : DB; + private geocode : Geocode; private tmp : string = tmpdir(); + private score : number; constructor () { this.log = createLog('generate'); + const parser = new ArgumentParser({ + description: 'Generate script' + }); + parser.add_argument('-s', '--score', { type : 'int', default : 0, help: 'Starting score' }); + const args : any = parser.parse_args(); + this.log.info(`Generating site: ${new Date()}`); this.db = new DB(); this.s3 = new Files3(envString('S3_BUCKET', 's3bucket'), true); + this.geocode = new Geocode(); this.generate(); + this.score = args.score; } private async generate () { @@ -59,6 +72,7 @@ class Generate { let filename : string; let meta : Metadata; let photo : Photo; + let exif : string; try { inbox = await realpath(this.inbox); @@ -135,28 +149,61 @@ class Generate { this.log.error(`Error uploading image`, err); continue; } + + try { + exif = await this.exif(photo); + } catch (err) { + this.log.error(`Error building EXIF data`, err); + } + + try { + await this.img(image, photo.id, exif); + } catch (err) { + this.log.error(`Error running img.sh script`, err); + } await this.move(image); } } - //Artist - //ImageTitle - //ImageUniqueID - //ISOSpeed - //DateTimeOriginal + //Artist string + //ImageTitle string + //ImageUniqueID string + //ISO int16u[n] + //DateTimeOriginal string (YYYY:MM:DD HH:MM:SS) + // + //GPSLatitude rational64u[3] + //GPSLongitude private async exif (photo : Photo) : Promise { const filePath : string = await this.mktemp('photosite_exif'); + const created : string = moment.unix(photo.created / 1000).format('YYYY:MM:DD HH:mm:ss'); + let exif : string = `-Artist=${this.artist} +-ImageTitle=${photo.name} +-ImageUniqueId=${photo.id} +-DateTimeOriginal=${created}` + const iso : number[] = photo.filmstock.split(' ').filter(el => this.isOnlyNumbers(el)).map(el => parseInt(el)).filter(el => el > 25); + + if (iso.length > 0) { + exif += ` +-ISO=${iso}` + } + + if (photo.latitude !== null && photo.longitude !== null) { + exif += ` +-GPSLatitude=${photo.latitude} +-GPSLongitude=${photo.longitude}` + } + try { - + await writeFile(filePath, exif, 'utf8'); } catch (err) { - + this.log.error(`Error writing EXIF data`, err); } return filePath; } private async img (file : string, id : string, exif : string) { - const cmd : string[] = ['bash', 'scripts/img.sh', file, exif]; + const cmd : string[] = ['bash', 'scripts/img.sh', file, id, exif]; const shell : Shell = new Shell(cmd); try { await shell.execute(); @@ -235,6 +282,8 @@ class Generate { const hash : string = await Hashes.fileHash(image); const dimensions : any = await this.getImageDimensions(image); const now : number = Date.now(); + const latlng : LatLng = await this.geocode.query(meta.location); + return { id : uuid(), name : basename(image), @@ -245,9 +294,12 @@ class Generate { format : meta.format, filmstock : meta.filmstock, location : meta.location, + latitude : latlng === null ? null : latlng.latitude, + longitude : latlng === null ? null : latlng.longitude, discovered : now, updated : now, - created : + new Date(meta.year, meta.month, meta.day) + created : + new Date(meta.year, meta.month, meta.day), + score : this.score } } @@ -261,7 +313,7 @@ class Generate { const dest : string = join(this.photos, name); try { - await rename(image, dest); + //await rename(image, dest); this.log.info(`Moved image ${name} to outbox`); } catch (err) { this.log.error(`Error moving image`, err); @@ -283,6 +335,10 @@ class Generate { } } } + + private isOnlyNumbers(str : string) : boolean { + return /^[0-9]+$/.test(str); + } } new Generate(); \ No newline at end of file diff --git a/src/geocode/index.ts b/src/geocode/index.ts new file mode 100644 index 0000000..f3dc60f --- /dev/null +++ b/src/geocode/index.ts @@ -0,0 +1,89 @@ +import 'dotenv/config'; + +import { URL } from 'url'; +import fetch from 'node-fetch'; +import type { Response } from 'node-fetch'; + +import { createLog } from '../log'; +import type { Logger } from 'winston'; +import { envString } from '../env'; +import { DB } from '../db'; +import type { LatLng } from '../db'; + +export class Geocode { + private log : Logger = createLog('geocode'); + private baseUrl : string = 'https://geocode.maps.co/search'; + private apiKey : string = envString('GEOCODE_API_KEY', null); + private db : DB = new DB(); + + constructor () { + + } + + public async query (location : string) : Promise { + let res : LatLng = await this.db.getLocation(location); + if (res === null) { + res = await this.api(location); + } + return res; + } + + private toLatLng (obj : any) : LatLng { + return { + latitude : parseFloat(obj.lat), + longitude : parseFloat(obj.lon) + }; + } + + //https://geocode.maps.co/search?q=&api_key=675738aa38619885468998kehbf6458 + private async api (location : string) : Promise { + const url : URL = new URL(this.baseUrl); + let response : Response; + let json : any; + let res : LatLng = null; + + url.searchParams.append('q', location); + + this.log.info(`Querying API: ${url.href}`); + url.searchParams.append('api_key', this.apiKey); + + await this.delay(1000); //rate limit to 1/sec + + try { + response = await fetch(url.href); + } catch (err) { + this.log.error('Error getting response', err); + return null; + } + + try { + json = await response.json(); + } catch (err) { + this.log.error('Error parsing json', err); + return null; + } + + if (json.length < 1) { + return null; + } + + res = this.toLatLng(json[0]); + + await this.db.cacheLocation(location, res); + + return res; + + } + + private async delay (ms : number) { + return new Promise ((resolve : Function, reject : Function) => { + return setTimeout(resolve, ms); + }); + } + + private cache (location : string, latitude : number, longitude : number) { + + } +} + +module.exports = { Geocode }; \ No newline at end of file diff --git a/src/shell/index.ts b/src/shell/index.ts index 77175b7..4da923a 100644 --- a/src/shell/index.ts +++ b/src/shell/index.ts @@ -31,7 +31,8 @@ export class Shell { this.log.info(`Shell: ${this.bin} ${this.args.join(' ')}`); - this.child.stdout.on('data', (data : string) => { + this.child.stdout.on('data', (output : Object) => { + const data : string = output.toString(); if (!this.silent) this.log.info(data); if (this.after !== null) this.lines.push(data); if (this.stdio !== null) { @@ -39,7 +40,8 @@ export class Shell { } }); - this.child.stderr.on('data', (data : string) => { + this.child.stderr.on('data', (output : Object) => { + const data : string = output.toString(); if (!this.silent) this.log.warn(data); if (this.stderr !== null) { this.stderr(data);