mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Support file-less scenes. Add scene split, merge and reassign file (#3006)
* Reassign scene file functionality * Implement scene create * Add scene create UI * Add sceneMerge backend support * Add merge scene to UI * Populate split create with scene details * Add merge button to duplicate checker * Handle file-less scenes in marker preview generate * Make unique file name for file-less scene exports * Add o-counter to scene update input * Hide rescan for file-less scenes * Generate heatmap if no speed set on file * Fix count in scene/image queries
This commit is contained in:
@@ -23,6 +23,13 @@ func (o *OptionalString) Ptr() *string {
|
||||
return &v
|
||||
}
|
||||
|
||||
// Merge sets the OptionalString if it is not already set, the destination value is empty and the source value is not empty.
|
||||
func (o *OptionalString) Merge(destVal string, srcVal string) {
|
||||
if destVal == "" && srcVal != "" && !o.Set {
|
||||
*o = NewOptionalString(srcVal)
|
||||
}
|
||||
}
|
||||
|
||||
// NewOptionalString returns a new OptionalString with the given value.
|
||||
func NewOptionalString(v string) OptionalString {
|
||||
return OptionalString{v, false, true}
|
||||
@@ -58,6 +65,13 @@ func (o *OptionalInt) Ptr() *int {
|
||||
return &v
|
||||
}
|
||||
|
||||
// MergePtr sets the OptionalInt if it is not already set, the destination value is nil and the source value is not nil.
|
||||
func (o *OptionalInt) MergePtr(destVal *int, srcVal *int) {
|
||||
if destVal == nil && srcVal != nil && !o.Set {
|
||||
*o = NewOptionalInt(*srcVal)
|
||||
}
|
||||
}
|
||||
|
||||
// NewOptionalInt returns a new OptionalInt with the given value.
|
||||
func NewOptionalInt(v int) OptionalInt {
|
||||
return OptionalInt{v, false, true}
|
||||
@@ -138,6 +152,13 @@ func (o *OptionalBool) Ptr() *bool {
|
||||
return &v
|
||||
}
|
||||
|
||||
// Merge sets the OptionalBool to true if it is not already set, the destination value is false and the source value is true.
|
||||
func (o *OptionalBool) Merge(destVal bool, srcVal bool) {
|
||||
if !destVal && srcVal && !o.Set {
|
||||
*o = NewOptionalBool(true)
|
||||
}
|
||||
}
|
||||
|
||||
// NewOptionalBool returns a new OptionalBool with the given value.
|
||||
func NewOptionalBool(v bool) OptionalBool {
|
||||
return OptionalBool{v, false, true}
|
||||
@@ -200,6 +221,13 @@ func NewOptionalDate(v Date) OptionalDate {
|
||||
return OptionalDate{v, false, true}
|
||||
}
|
||||
|
||||
// Merge sets the OptionalDate if it is not already set, the destination value is nil and the source value is nil.
|
||||
func (o *OptionalDate) MergePtr(destVal *Date, srcVal *Date) {
|
||||
if destVal == nil && srcVal != nil && !o.Set {
|
||||
*o = NewOptionalDate(*srcVal)
|
||||
}
|
||||
}
|
||||
|
||||
// NewOptionalBoolPtr returns a new OptionalDate with the given value.
|
||||
// If the value is nil, the returned OptionalDate will be set and null.
|
||||
func NewOptionalDatePtr(v *Date) OptionalDate {
|
||||
|
||||
Reference in New Issue
Block a user