categorys and titles for images

This commit is contained in:
Zutatensuppe 2021-05-22 01:51:44 +02:00
parent 8abbb13fcc
commit 239c879649
22 changed files with 964 additions and 86 deletions

23
scripts/import_images.ts Normal file
View file

@ -0,0 +1,23 @@
import { DB_FILE, DB_PATCHES_DIR } from '../src/server/Dirs'
import Db from '../src/server/Db'
import Images from '../src/server/Images'
const db = new Db(DB_FILE, DB_PATCHES_DIR)
db.patch(true)
const cat = ''
const sort = 'date_desc'
let images = Images.allImagesFromDisk(cat, sort)
images.forEach((image: any) => {
db.upsert('images', {
filename: image.filename,
filename_original: image.filename,
title: image.title,
created: image.created / 1000,
}, {
filename: image.filename
})
})
images = Images.allImagesFromDb(db, cat, sort)
console.log(images)