categorys and titles for images
This commit is contained in:
parent
8abbb13fcc
commit
239c879649
22 changed files with 964 additions and 86 deletions
23
scripts/import_images.ts
Normal file
23
scripts/import_images.ts
Normal 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue