Scene filename to metadata parser (#164)

* Initial UI prototype

* Add backend support to update multiple scenes

* Fix title editing issues

* Add query regex support. UI improvements

* Rewrite parser. Add fields button and page size

* Add helper text for escaping {} characters

* Validate date

* Only set values if different from original

* Only update scenes that have something changed

* Add built in parser input recipes

* Make pattern matching case-insensistive
This commit is contained in:
WithoutPants
2019-10-31 00:37:21 +11:00
committed by Leopere
parent e59fd147cf
commit 7cb9cd8a38
12 changed files with 1140 additions and 14 deletions

View File

@@ -291,6 +291,32 @@ func getMultiCriterionClause(table string, joinTable string, joinTableField stri
return whereClause, havingClause
}
func (qb *SceneQueryBuilder) QueryByPathRegex(findFilter *FindFilterType) ([]*Scene, int) {
if findFilter == nil {
findFilter = &FindFilterType{}
}
var whereClauses []string
var havingClauses []string
var args []interface{}
body := selectDistinctIDs("scenes")
if q := findFilter.Q; q != nil && *q != "" {
whereClauses = append(whereClauses, "scenes.path regexp '" + *q + "'")
}
sortAndPagination := qb.getSceneSort(findFilter) + getPagination(findFilter)
idsResult, countResult := executeFindQuery("scenes", body, args, sortAndPagination, whereClauses, havingClauses)
var scenes []*Scene
for _, id := range idsResult {
scene, _ := qb.Find(id)
scenes = append(scenes, scene)
}
return scenes, countResult
}
func (qb *SceneQueryBuilder) getSceneSort(findFilter *FindFilterType) string {
if findFilter == nil {
return " ORDER BY scenes.path, scenes.date ASC "