92e6c4fe1e
Extends DownloadSettings with 4 additional options: - Name: File name pattern for downloaded files (existed) - Disabled: Disables downloads - Originals: Only download files stored in "originals" folder - MediaRaw: Include RAW image files - MediaSidecar: Include metadata sidecar files (JSON, XMP, YAML)
29 lines
599 B
Go
29 lines
599 B
Go
package query
|
|
|
|
import "github.com/photoprism/photoprism/pkg/txt"
|
|
|
|
type CategoryLabel struct {
|
|
Name string
|
|
Title string
|
|
}
|
|
|
|
func CategoryLabels(limit, offset int) (results []CategoryLabel) {
|
|
s := Db().NewScope(nil).DB()
|
|
|
|
s = s.Table("categories").
|
|
Select("label_name AS name").
|
|
Joins("JOIN labels l ON categories.category_id = l.id").
|
|
Group("label_name").
|
|
Limit(limit).Offset(offset)
|
|
|
|
if err := s.Scan(&results).Error; err != nil {
|
|
log.Errorf("categories: %s", err.Error())
|
|
return results
|
|
}
|
|
|
|
for i, l := range results {
|
|
results[i].Title = txt.Title(l.Name)
|
|
}
|
|
|
|
return results
|
|
}
|