Generate content for specific scenes (#672)

* Add UI dialog for scene(s)
* Move preview preset to config
This commit is contained in:
WithoutPants
2020-07-19 11:59:18 +10:00
committed by GitHub
parent 8e4945325d
commit c104c6d075
27 changed files with 552 additions and 148 deletions

View File

@@ -2,6 +2,7 @@ package models
import (
"database/sql"
"fmt"
"path/filepath"
"strconv"
@@ -82,6 +83,24 @@ func (qb *GalleryQueryBuilder) Find(id int) (*Gallery, error) {
return qb.queryGallery(query, args, nil)
}
func (qb *GalleryQueryBuilder) FindMany(ids []int) ([]*Gallery, error) {
var galleries []*Gallery
for _, id := range ids {
gallery, err := qb.Find(id)
if err != nil {
return nil, err
}
if gallery == nil {
return nil, fmt.Errorf("gallery with id %d not found", id)
}
galleries = append(galleries, gallery)
}
return galleries, nil
}
func (qb *GalleryQueryBuilder) FindByChecksum(checksum string, tx *sqlx.Tx) (*Gallery, error) {
query := "SELECT * FROM galleries WHERE checksum = ? LIMIT 1"
args := []interface{}{checksum}