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)
|
||||
|
|
@ -1,5 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
# TODO: add switch via param
|
||||
|
||||
# server for built files
|
||||
cd "$RUN_DIR/build/server"
|
||||
|
||||
nodemon --max-old-space-size=64 main.js -c ../../config.json
|
||||
|
||||
# dev server
|
||||
# npm run ts-node src/server/main.ts -- -c config.json
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue