Add scene auto-tagging from filename (#204)

* Add auto tagging for performers, studios and tags

* Fix scene title logging

* Fix golang 1.11 compile error

* Improve regex pattern. Only log when added

* Remove paging from parse query

* Add integration test

* Fix prefix detection on paths
This commit is contained in:
WithoutPants
2019-12-02 03:18:44 +11:00
committed by Leopere
parent ca2680a86d
commit 1704d3771f
17 changed files with 991 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ package models
import (
"database/sql"
"path/filepath"
)
type Scene struct {
@@ -27,7 +28,7 @@ type Scene struct {
}
type ScenePartial struct {
ID int `db:"id" json:"id"`
ID int `db:"id" json:"id"`
Checksum *string `db:"checksum" json:"checksum"`
Path *string `db:"path" json:"path"`
Title *sql.NullString `db:"title" json:"title"`
@@ -47,3 +48,11 @@ type ScenePartial struct {
CreatedAt *SQLiteTimestamp `db:"created_at" json:"created_at"`
UpdatedAt *SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}
func (s Scene) GetTitle() string {
if s.Title.String != "" {
return s.Title.String
}
return filepath.Base(s.Path)
}