mirror of
https://github.com/stashapp/stash.git
synced 2026-01-17 21:52:55 +01:00
Use basename as title if empty when scraping by fragment (#3040)
* Fallback to file basename if title empty in scrape * Populate dialog from basename if title empty
This commit is contained in:
parent
091950615e
commit
47395ce13f
3 changed files with 11 additions and 4 deletions
|
|
@ -2,6 +2,7 @@ package models
|
|||
|
||||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
|
@ -128,7 +129,7 @@ func (g Gallery) GetTitle() string {
|
|||
return g.Title
|
||||
}
|
||||
|
||||
return g.Path
|
||||
return filepath.Base(g.Path)
|
||||
}
|
||||
|
||||
// DisplayName returns a display name for the scene for logging purposes.
|
||||
|
|
|
|||
|
|
@ -319,9 +319,12 @@ func sceneToUpdateInput(scene *models.Scene) models.SceneUpdateInput {
|
|||
return nil
|
||||
}
|
||||
|
||||
// fallback to file basename if title is empty
|
||||
title := scene.GetTitle()
|
||||
|
||||
return models.SceneUpdateInput{
|
||||
ID: strconv.Itoa(scene.ID),
|
||||
Title: &scene.Title,
|
||||
Title: &title,
|
||||
Details: &scene.Details,
|
||||
URL: &scene.URL,
|
||||
Date: dateToStringPtr(scene.Date),
|
||||
|
|
@ -338,9 +341,12 @@ func galleryToUpdateInput(gallery *models.Gallery) models.GalleryUpdateInput {
|
|||
return nil
|
||||
}
|
||||
|
||||
// fallback to file basename if title is empty
|
||||
title := gallery.GetTitle()
|
||||
|
||||
return models.GalleryUpdateInput{
|
||||
ID: strconv.Itoa(gallery.ID),
|
||||
Title: &gallery.Title,
|
||||
Title: &title,
|
||||
Details: &gallery.Details,
|
||||
URL: &gallery.URL,
|
||||
Date: dateToStringPtr(gallery.Date),
|
||||
|
|
|
|||
|
|
@ -476,7 +476,7 @@ export const SceneEditPanel: React.FC<IProps> = ({
|
|||
setScraper(undefined);
|
||||
onSceneSelected(s);
|
||||
}}
|
||||
name={formik.values.title || ""}
|
||||
name={formik.values.title || objectTitle(scene) || ""}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue