Add Studio Code and Photographer to Galleries. (#4195)

* Added Studio Code and Photographer to Galleries
* Fix gallery display on mobile
* Fixed potential panic when scraping with a bad configuration
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
bob123491234
2023-11-27 22:05:33 -06:00
committed by GitHub
parent b78771dbcd
commit d1018b4c5d
25 changed files with 243 additions and 102 deletions

View File

@@ -1,9 +1,11 @@
fragment SlimGalleryData on Gallery {
id
title
code
date
urls
details
photographer
rating100
organized
files {

View File

@@ -3,9 +3,11 @@ fragment GalleryData on Gallery {
created_at
updated_at
title
code
date
urls
details
photographer
rating100
organized

View File

@@ -184,8 +184,10 @@ fragment ScrapedSceneData on ScrapedScene {
fragment ScrapedGalleryData on ScrapedGallery {
title
code
details
urls
photographer
date
studio {

View File

@@ -377,6 +377,10 @@ input GalleryFilterType {
created_at: TimestampCriterionInput
"Filter by last update time"
updated_at: TimestampCriterionInput
"Filter by studio code"
code: StringCriterionInput
"Filter by photographer"
photographer: StringCriterionInput
}
input TagFilterType {

View File

@@ -2,10 +2,12 @@
type Gallery {
id: ID!
title: String
code: String
url: String @deprecated(reason: "Use urls")
urls: [String!]!
date: String
details: String
photographer: String
# rating expressed as 1-100
rating100: Int
organized: Boolean!
@@ -27,10 +29,12 @@ type Gallery {
input GalleryCreateInput {
title: String!
code: String
url: String @deprecated(reason: "Use urls")
urls: [String!]
date: String
details: String
photographer: String
# rating expressed as 1-100
rating100: Int
organized: Boolean
@@ -44,10 +48,12 @@ input GalleryUpdateInput {
clientMutationId: String
id: ID!
title: String
code: String
url: String @deprecated(reason: "Use urls")
urls: [String!]
date: String
details: String
photographer: String
# rating expressed as 1-100
rating100: Int
organized: Boolean
@@ -62,10 +68,12 @@ input GalleryUpdateInput {
input BulkGalleryUpdateInput {
clientMutationId: String
ids: [ID!]
code: String
url: String @deprecated(reason: "Use urls")
urls: BulkUpdateStrings
date: String
details: String
photographer: String
# rating expressed as 1-100
rating100: Int
organized: Boolean

View File

@@ -99,7 +99,9 @@ input ScrapedSceneInput {
type ScrapedGallery {
title: String
code: String
details: String
photographer: String
url: String @deprecated(reason: "use urls")
urls: [String!]
date: String
@@ -111,7 +113,9 @@ type ScrapedGallery {
input ScrapedGalleryInput {
title: String
code: String
details: String
photographer: String
url: String @deprecated(reason: "use urls")
urls: [String!]
date: String

View File

@@ -43,7 +43,9 @@ func (r *mutationResolver) GalleryCreate(ctx context.Context, input GalleryCreat
newGallery := models.NewGallery()
newGallery.Title = input.Title
newGallery.Code = translator.string(input.Code)
newGallery.Details = translator.string(input.Details)
newGallery.Photographer = translator.string(input.Photographer)
newGallery.Rating = input.Rating100
var err error
@@ -182,7 +184,9 @@ func (r *mutationResolver) galleryUpdate(ctx context.Context, input models.Galle
updatedGallery.Title = models.NewOptionalString(*input.Title)
}
updatedGallery.Code = translator.optionalString(input.Code, "code")
updatedGallery.Details = translator.optionalString(input.Details, "details")
updatedGallery.Photographer = translator.optionalString(input.Photographer, "photographer")
updatedGallery.Rating = translator.optionalInt(input.Rating100, "rating100")
updatedGallery.Organized = translator.optionalBool(input.Organized, "organized")
@@ -257,7 +261,9 @@ func (r *mutationResolver) BulkGalleryUpdate(ctx context.Context, input BulkGall
// Populate gallery from the input
updatedGallery := models.NewGalleryPartial()
updatedGallery.Code = translator.optionalString(input.Code, "code")
updatedGallery.Details = translator.optionalString(input.Details, "details")
updatedGallery.Photographer = translator.optionalString(input.Photographer, "photographer")
updatedGallery.Rating = translator.optionalInt(input.Rating100, "rating100")
updatedGallery.Organized = translator.optionalBool(input.Organized, "organized")
updatedGallery.URLs = translator.optionalURLsBulk(input.Urls, input.URL)

View File

@@ -13,11 +13,13 @@ import (
// does not convert the relationships to other objects.
func ToBasicJSON(gallery *models.Gallery) (*jsonschema.Gallery, error) {
newGalleryJSON := jsonschema.Gallery{
Title: gallery.Title,
URLs: gallery.URLs.List(),
Details: gallery.Details,
CreatedAt: json.JSONTime{Time: gallery.CreatedAt},
UpdatedAt: json.JSONTime{Time: gallery.UpdatedAt},
Title: gallery.Title,
Code: gallery.Code,
URLs: gallery.URLs.List(),
Details: gallery.Details,
Photographer: gallery.Photographer,
CreatedAt: json.JSONTime{Time: gallery.CreatedAt},
UpdatedAt: json.JSONTime{Time: gallery.UpdatedAt},
}
if gallery.FolderID != nil {

View File

@@ -62,9 +62,15 @@ func (i *Importer) galleryJSONToGallery(galleryJSON jsonschema.Gallery) models.G
if galleryJSON.Title != "" {
newGallery.Title = galleryJSON.Title
}
if galleryJSON.Code != "" {
newGallery.Code = galleryJSON.Code
}
if galleryJSON.Details != "" {
newGallery.Details = galleryJSON.Details
}
if galleryJSON.Photographer != "" {
newGallery.Photographer = galleryJSON.Photographer
}
if len(galleryJSON.URLs) > 0 {
newGallery.URLs = models.NewRelatedStrings(galleryJSON.URLs)
} else if galleryJSON.URL != "" {

View File

@@ -1,12 +1,14 @@
package models
type GalleryFilterType struct {
And *GalleryFilterType `json:"AND"`
Or *GalleryFilterType `json:"OR"`
Not *GalleryFilterType `json:"NOT"`
ID *IntCriterionInput `json:"id"`
Title *StringCriterionInput `json:"title"`
Details *StringCriterionInput `json:"details"`
And *GalleryFilterType `json:"AND"`
Or *GalleryFilterType `json:"OR"`
Not *GalleryFilterType `json:"NOT"`
ID *IntCriterionInput `json:"id"`
Title *StringCriterionInput `json:"title"`
Code *StringCriterionInput `json:"code"`
Details *StringCriterionInput `json:"details"`
Photographer *StringCriterionInput `json:"photographer"`
// Filter by file checksum
Checksum *StringCriterionInput `json:"checksum"`
// Filter by path
@@ -57,9 +59,11 @@ type GalleryUpdateInput struct {
ClientMutationID *string `json:"clientMutationId"`
ID string `json:"id"`
Title *string `json:"title"`
Code *string `json:"code"`
Urls []string `json:"urls"`
Date *string `json:"date"`
Details *string `json:"details"`
Photographer *string `json:"photographer"`
Rating100 *int `json:"rating100"`
Organized *bool `json:"organized"`
SceneIds []string `json:"scene_ids"`

View File

@@ -18,20 +18,22 @@ type GalleryChapter struct {
}
type Gallery struct {
ZipFiles []string `json:"zip_files,omitempty"`
FolderPath string `json:"folder_path,omitempty"`
Title string `json:"title,omitempty"`
URLs []string `json:"urls,omitempty"`
Date string `json:"date,omitempty"`
Details string `json:"details,omitempty"`
Rating int `json:"rating,omitempty"`
Organized bool `json:"organized,omitempty"`
Chapters []GalleryChapter `json:"chapters,omitempty"`
Studio string `json:"studio,omitempty"`
Performers []string `json:"performers,omitempty"`
Tags []string `json:"tags,omitempty"`
CreatedAt json.JSONTime `json:"created_at,omitempty"`
UpdatedAt json.JSONTime `json:"updated_at,omitempty"`
ZipFiles []string `json:"zip_files,omitempty"`
FolderPath string `json:"folder_path,omitempty"`
Title string `json:"title,omitempty"`
Code string `json:"code,omitempty"`
URLs []string `json:"urls,omitempty"`
Date string `json:"date,omitempty"`
Details string `json:"details,omitempty"`
Photographer string `json:"photographer,omitempty"`
Rating int `json:"rating,omitempty"`
Organized bool `json:"organized,omitempty"`
Chapters []GalleryChapter `json:"chapters,omitempty"`
Studio string `json:"studio,omitempty"`
Performers []string `json:"performers,omitempty"`
Tags []string `json:"tags,omitempty"`
CreatedAt json.JSONTime `json:"created_at,omitempty"`
UpdatedAt json.JSONTime `json:"updated_at,omitempty"`
// deprecated - for import only
URL string `json:"url,omitempty"`

View File

@@ -10,9 +10,11 @@ import (
type Gallery struct {
ID int `json:"id"`
Title string `json:"title"`
Date *Date `json:"date"`
Details string `json:"details"`
Title string `json:"title"`
Code string `json:"code"`
Date *Date `json:"date"`
Details string `json:"details"`
Photographer string `json:"photographer"`
// Rating expressed in 1-100 scale
Rating *int `json:"rating"`
Organized bool `json:"organized"`
@@ -50,10 +52,12 @@ type GalleryPartial struct {
// Path OptionalString
// Checksum OptionalString
// Zip OptionalBool
Title OptionalString
URLs *UpdateStrings
Date OptionalDate
Details OptionalString
Title OptionalString
Code OptionalString
URLs *UpdateStrings
Date OptionalDate
Details OptionalString
Photographer OptionalString
// Rating expressed in 1-100 scale
Rating OptionalInt
Organized OptionalBool

View File

@@ -3,13 +3,15 @@ package scraper
import "github.com/stashapp/stash/pkg/models"
type ScrapedGallery struct {
Title *string `json:"title"`
Details *string `json:"details"`
URLs []string `json:"urls"`
Date *string `json:"date"`
Studio *models.ScrapedStudio `json:"studio"`
Tags []*models.ScrapedTag `json:"tags"`
Performers []*models.ScrapedPerformer `json:"performers"`
Title *string `json:"title"`
Code *string `json:"code"`
Details *string `json:"details"`
Photographer *string `json:"photographer"`
URLs []string `json:"urls"`
Date *string `json:"date"`
Studio *models.ScrapedStudio `json:"studio"`
Tags []*models.ScrapedTag `json:"tags"`
Performers []*models.ScrapedPerformer `json:"performers"`
// deprecated
URL *string `json:"url"`
@@ -18,10 +20,12 @@ type ScrapedGallery struct {
func (ScrapedGallery) IsScrapedContent() {}
type ScrapedGalleryInput struct {
Title *string `json:"title"`
Details *string `json:"details"`
URLs []string `json:"urls"`
Date *string `json:"date"`
Title *string `json:"title"`
Code *string `json:"code"`
Details *string `json:"details"`
Photographer *string `json:"photographer"`
URLs []string `json:"urls"`
Date *string `json:"date"`
// deprecated
URL *string `json:"url"`

View File

@@ -972,11 +972,12 @@ func (s mappedScraper) scrapeScenes(ctx context.Context, q mappedQuery) ([]*Scra
func (s mappedScraper) scrapeScene(ctx context.Context, q mappedQuery) (*ScrapedScene, error) {
sceneScraperConfig := s.Scene
sceneMap := sceneScraperConfig.mappedConfig
if sceneMap == nil {
if sceneScraperConfig == nil {
return nil, nil
}
sceneMap := sceneScraperConfig.mappedConfig
logger.Debug(`Processing scene:`)
results := sceneMap.process(ctx, q, s.Common)
@@ -1000,11 +1001,12 @@ func (s mappedScraper) scrapeGallery(ctx context.Context, q mappedQuery) (*Scrap
var ret ScrapedGallery
galleryScraperConfig := s.Gallery
galleryMap := galleryScraperConfig.mappedConfig
if galleryMap == nil {
if galleryScraperConfig == nil {
return nil, nil
}
galleryMap := galleryScraperConfig.mappedConfig
galleryPerformersMap := galleryScraperConfig.Performers
galleryTagsMap := galleryScraperConfig.Tags
galleryStudioMap := galleryScraperConfig.Studio
@@ -1062,11 +1064,12 @@ func (s mappedScraper) scrapeMovie(ctx context.Context, q mappedQuery) (*models.
var ret models.ScrapedMovie
movieScraperConfig := s.Movie
movieMap := movieScraperConfig.mappedConfig
if movieMap == nil {
if movieScraperConfig == nil {
return nil, nil
}
movieMap := movieScraperConfig.mappedConfig
movieStudioMap := movieScraperConfig.Studio
results := movieMap.process(ctx, q, s.Common)

View File

@@ -33,7 +33,7 @@ const (
dbConnTimeout = 30
)
var appSchemaVersion uint = 52
var appSchemaVersion uint = 53
//go:embed migrations/*.sql
var migrationsBox embed.FS

View File

@@ -31,10 +31,12 @@ const (
)
type galleryRow struct {
ID int `db:"id" goqu:"skipinsert"`
Title zero.String `db:"title"`
Date NullDate `db:"date"`
Details zero.String `db:"details"`
ID int `db:"id" goqu:"skipinsert"`
Title zero.String `db:"title"`
Code zero.String `db:"code"`
Date NullDate `db:"date"`
Details zero.String `db:"details"`
Photographer zero.String `db:"photographer"`
// expressed as 1-100
Rating null.Int `db:"rating"`
Organized bool `db:"organized"`
@@ -47,8 +49,10 @@ type galleryRow struct {
func (r *galleryRow) fromGallery(o models.Gallery) {
r.ID = o.ID
r.Title = zero.StringFrom(o.Title)
r.Code = zero.StringFrom(o.Code)
r.Date = NullDateFromDatePtr(o.Date)
r.Details = zero.StringFrom(o.Details)
r.Photographer = zero.StringFrom(o.Photographer)
r.Rating = intFromPtr(o.Rating)
r.Organized = o.Organized
r.StudioID = intFromPtr(o.StudioID)
@@ -70,8 +74,10 @@ func (r *galleryQueryRow) resolve() *models.Gallery {
ret := &models.Gallery{
ID: r.ID,
Title: r.Title.String,
Code: r.Code.String,
Date: r.Date.DatePtr(),
Details: r.Details.String,
Photographer: r.Photographer.String,
Rating: nullIntPtr(r.Rating),
Organized: r.Organized,
StudioID: nullIntPtr(r.StudioID),
@@ -96,8 +102,10 @@ type galleryRowRecord struct {
func (r *galleryRowRecord) fromPartial(o models.GalleryPartial) {
r.setNullString("title", o.Title)
r.setNullString("code", o.Code)
r.setNullDate("date", o.Date)
r.setNullString("details", o.Details)
r.setNullString("photographer", o.Photographer)
r.setNullInt("rating", o.Rating)
r.setBool("organized", o.Organized)
r.setNullInt("studio_id", o.StudioID)
@@ -655,7 +663,9 @@ func (qb *GalleryStore) makeFilter(ctx context.Context, galleryFilter *models.Ga
query.handleCriterion(ctx, intCriterionHandler(galleryFilter.ID, "galleries.id", nil))
query.handleCriterion(ctx, stringCriterionHandler(galleryFilter.Title, "galleries.title"))
query.handleCriterion(ctx, stringCriterionHandler(galleryFilter.Code, "galleries.code"))
query.handleCriterion(ctx, stringCriterionHandler(galleryFilter.Details, "galleries.details"))
query.handleCriterion(ctx, stringCriterionHandler(galleryFilter.Photographer, "galleries.photographer"))
query.handleCriterion(ctx, criterionHandlerFunc(func(ctx context.Context, f *filterBuilder) {
if galleryFilter.Checksum != nil {

View File

@@ -56,12 +56,14 @@ func loadGalleryRelationships(ctx context.Context, expected models.Gallery, actu
func Test_galleryQueryBuilder_Create(t *testing.T) {
var (
title = "title"
url = "url"
rating = 60
details = "details"
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
title = "title"
code = "1337"
url = "url"
rating = 60
details = "details"
photographer = "photographer"
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
galleryFile = makeFileWithID(fileIdxStartGalleryFiles)
)
@@ -77,9 +79,11 @@ func Test_galleryQueryBuilder_Create(t *testing.T) {
"full",
models.Gallery{
Title: title,
Code: code,
URLs: models.NewRelatedStrings([]string{url}),
Date: &date,
Details: details,
Photographer: photographer,
Rating: &rating,
Organized: true,
StudioID: &studioIDs[studioIdxWithScene],
@@ -94,13 +98,15 @@ func Test_galleryQueryBuilder_Create(t *testing.T) {
{
"with file",
models.Gallery{
Title: title,
URLs: models.NewRelatedStrings([]string{url}),
Date: &date,
Details: details,
Rating: &rating,
Organized: true,
StudioID: &studioIDs[studioIdxWithScene],
Title: title,
Code: code,
URLs: models.NewRelatedStrings([]string{url}),
Date: &date,
Details: details,
Photographer: photographer,
Rating: &rating,
Organized: true,
StudioID: &studioIDs[studioIdxWithScene],
Files: models.NewRelatedFiles([]models.File{
galleryFile,
}),
@@ -207,12 +213,14 @@ func makeGalleryFileWithID(i int) *models.BaseFile {
func Test_galleryQueryBuilder_Update(t *testing.T) {
var (
title = "title"
url = "url"
rating = 60
details = "details"
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
title = "title"
code = "code"
url = "url"
rating = 60
details = "details"
photographer = "photographer"
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
)
date, _ := models.ParseDate("2003-02-01")
@@ -225,14 +233,16 @@ func Test_galleryQueryBuilder_Update(t *testing.T) {
{
"full",
&models.Gallery{
ID: galleryIDs[galleryIdxWithScene],
Title: title,
URLs: models.NewRelatedStrings([]string{url}),
Date: &date,
Details: details,
Rating: &rating,
Organized: true,
StudioID: &studioIDs[studioIdxWithScene],
ID: galleryIDs[galleryIdxWithScene],
Title: title,
Code: code,
URLs: models.NewRelatedStrings([]string{url}),
Date: &date,
Details: details,
Photographer: photographer,
Rating: &rating,
Organized: true,
StudioID: &studioIDs[studioIdxWithScene],
Files: models.NewRelatedFiles([]models.File{
makeGalleryFileWithID(galleryIdxWithScene),
}),
@@ -389,7 +399,9 @@ func clearGalleryPartial() models.GalleryPartial {
// leave mandatory fields
return models.GalleryPartial{
Title: models.OptionalString{Set: true, Null: true},
Code: models.OptionalString{Set: true, Null: true},
Details: models.OptionalString{Set: true, Null: true},
Photographer: models.OptionalString{Set: true, Null: true},
URLs: &models.UpdateStrings{Mode: models.RelationshipUpdateModeSet},
Date: models.OptionalDate{Set: true, Null: true},
Rating: models.OptionalInt{Set: true, Null: true},
@@ -401,12 +413,14 @@ func clearGalleryPartial() models.GalleryPartial {
func Test_galleryQueryBuilder_UpdatePartial(t *testing.T) {
var (
title = "title"
details = "details"
url = "url"
rating = 60
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
title = "title"
code = "code"
details = "details"
photographer = "photographer"
url = "url"
rating = 60
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
date, _ = models.ParseDate("2003-02-01")
)
@@ -422,8 +436,10 @@ func Test_galleryQueryBuilder_UpdatePartial(t *testing.T) {
"full",
galleryIDs[galleryIdxWithImage],
models.GalleryPartial{
Title: models.NewOptionalString(title),
Details: models.NewOptionalString(details),
Title: models.NewOptionalString(title),
Code: models.NewOptionalString(code),
Details: models.NewOptionalString(details),
Photographer: models.NewOptionalString(photographer),
URLs: &models.UpdateStrings{
Values: []string{url},
Mode: models.RelationshipUpdateModeSet,
@@ -449,14 +465,16 @@ func Test_galleryQueryBuilder_UpdatePartial(t *testing.T) {
},
},
models.Gallery{
ID: galleryIDs[galleryIdxWithImage],
Title: title,
Details: details,
URLs: models.NewRelatedStrings([]string{url}),
Date: &date,
Rating: &rating,
Organized: true,
StudioID: &studioIDs[studioIdxWithGallery],
ID: galleryIDs[galleryIdxWithImage],
Title: title,
Code: code,
Details: details,
Photographer: photographer,
URLs: models.NewRelatedStrings([]string{url}),
Date: &date,
Rating: &rating,
Organized: true,
StudioID: &studioIDs[studioIdxWithGallery],
Files: models.NewRelatedFiles([]models.File{
makeGalleryFile(galleryIdxWithImage),
}),

View File

@@ -0,0 +1,2 @@
ALTER TABLE `galleries` ADD COLUMN `code` text;
ALTER TABLE `galleries` ADD COLUMN `photographer` text;

View File

@@ -24,7 +24,7 @@ export const GalleryDetailPanel: React.FC<IGalleryDetailProps> = ({
return (
<>
<h6>
<FormattedMessage id="details" />
<FormattedMessage id="details" />:{" "}
</h6>
<p className="pre">{gallery.details}</p>
</>
@@ -111,6 +111,16 @@ export const GalleryDetailPanel: React.FC<IGalleryDetailProps> = ({
<FormattedMessage id="updated_at" />:{" "}
{TextUtils.formatDateTime(intl, gallery.updated_at)}{" "}
</h6>
{gallery.code && (
<h6>
<FormattedMessage id="scene_code" />: {gallery.code}{" "}
</h6>
)}
{gallery.photographer && (
<h6>
<FormattedMessage id="photographer" />: {gallery.photographer}{" "}
</h6>
)}
</div>
{gallery.studio && (
<div className="col-3 d-xl-none">

View File

@@ -86,8 +86,10 @@ export const GalleryEditPanel: React.FC<IProps> = ({
const schema = yup.object({
title: titleRequired ? yup.string().required() : yup.string().ensure(),
code: yup.string().ensure(),
urls: yupUniqueStringList("urls"),
date: yupDateString(intl),
photographer: yup.string().ensure(),
rating100: yup.number().integer().nullable().defined(),
studio_id: yup.string().required().nullable(),
performer_ids: yup.array(yup.string().required()).defined(),
@@ -98,8 +100,10 @@ export const GalleryEditPanel: React.FC<IProps> = ({
const initialValues = {
title: gallery?.title ?? "",
code: gallery?.code ?? "",
urls: gallery?.urls ?? [],
date: gallery?.date ?? "",
photographer: gallery?.photographer ?? "",
rating100: gallery?.rating100 ?? null,
studio_id: gallery?.studio?.id ?? null,
performer_ids: (gallery?.performers ?? []).map((p) => p.id),
@@ -288,10 +292,18 @@ export const GalleryEditPanel: React.FC<IProps> = ({
formik.setFieldValue("title", galleryData.title);
}
if (galleryData.code) {
formik.setFieldValue("code", galleryData.code);
}
if (galleryData.details) {
formik.setFieldValue("details", galleryData.details);
}
if (galleryData.photographer) {
formik.setFieldValue("photographer", galleryData.photographer);
}
if (galleryData.date) {
formik.setFieldValue("date", galleryData.date);
}
@@ -490,6 +502,7 @@ export const GalleryEditPanel: React.FC<IProps> = ({
<Row className="form-container px-3">
<Col lg={7} xl={12}>
{renderInputField("title")}
{renderInputField("code", "text", "scene_code")}
{renderURLListField(
"urls",
@@ -499,6 +512,7 @@ export const GalleryEditPanel: React.FC<IProps> = ({
)}
{renderDateField("date")}
{renderInputField("photographer")}
{renderRatingField("rating100", "rating")}
{renderScenesField()}

View File

@@ -48,6 +48,9 @@ export const GalleryScrapeDialog: React.FC<IGalleryScrapeDialogProps> = ({
const [title, setTitle] = useState<ScrapeResult<string>>(
new ScrapeResult<string>(gallery.title, scraped.title)
);
const [code, setCode] = useState<ScrapeResult<string>>(
new ScrapeResult<string>(gallery.code, scraped.code)
);
const [urls, setURLs] = useState<ScrapeResult<string[]>>(
new ScrapeResult<string[]>(
gallery.urls,
@@ -59,6 +62,9 @@ export const GalleryScrapeDialog: React.FC<IGalleryScrapeDialogProps> = ({
const [date, setDate] = useState<ScrapeResult<string>>(
new ScrapeResult<string>(gallery.date, scraped.date)
);
const [photographer, setPhotographer] = useState<ScrapeResult<string>>(
new ScrapeResult<string>(gallery.photographer, scraped.photographer)
);
const [studio, setStudio] = useState<ScrapeResult<string>>(
new ScrapeResult<string>(gallery.studio_id, scraped.studio?.stored_id)
);
@@ -157,9 +163,17 @@ export const GalleryScrapeDialog: React.FC<IGalleryScrapeDialogProps> = ({
// don't show the dialog if nothing was scraped
if (
[title, urls, date, studio, performers, tags, details].every(
(r) => !r.scraped
) &&
[
title,
code,
urls,
date,
photographer,
studio,
performers,
tags,
details,
].every((r) => !r.scraped) &&
!newStudio &&
newPerformers.length === 0 &&
newTags.length === 0
@@ -173,8 +187,10 @@ export const GalleryScrapeDialog: React.FC<IGalleryScrapeDialogProps> = ({
return {
title: title.getNewValue(),
code: code.getNewValue(),
urls: urls.getNewValue(),
date: date.getNewValue(),
photographer: photographer.getNewValue(),
studio: newStudioValue
? {
stored_id: newStudioValue,
@@ -200,6 +216,11 @@ export const GalleryScrapeDialog: React.FC<IGalleryScrapeDialogProps> = ({
result={title}
onChange={(value) => setTitle(value)}
/>
<ScrapedInputGroupRow
title={intl.formatMessage({ id: "scene_code" })}
result={code}
onChange={(value) => setCode(value)}
/>
<ScrapedStringListRow
title={intl.formatMessage({ id: "urls" })}
result={urls}
@@ -211,6 +232,11 @@ export const GalleryScrapeDialog: React.FC<IGalleryScrapeDialogProps> = ({
result={date}
onChange={(value) => setDate(value)}
/>
<ScrapedInputGroupRow
title={intl.formatMessage({ id: "photographer" })}
result={photographer}
onChange={(value) => setPhotographer(value)}
/>
<ScrapedStudioRow
title={intl.formatMessage({ id: "studios" })}
result={studio}

View File

@@ -52,6 +52,7 @@
.gallery-tabs {
max-height: calc(100vh - 4rem);
overflow: auto;
overflow-wrap: break-word;
word-wrap: break-word;
}
@@ -62,7 +63,6 @@ $galleryTabWidth: 450px;
.gallery-tabs {
flex: 0 0 $galleryTabWidth;
max-width: $galleryTabWidth;
overflow: auto;
&.collapsed {
display: none;
@@ -285,3 +285,7 @@ $galleryTabWidth: 450px;
margin-bottom: 0;
}
}
.col-form-label {
padding-right: 2px;
}

View File

@@ -1160,6 +1160,7 @@
"updating_untagged_performers_description": "Updating untagged performers will try to match any performers that lack a stashid and update the metadata."
},
"performers": "Performers",
"photographer": "Photographer",
"piercings": "Piercings",
"play_count": "Play Count",
"play_duration": "Play Duration",

View File

@@ -43,7 +43,9 @@ const displayModeOptions = [
const criterionOptions = [
createStringCriterionOption("title"),
createStringCriterionOption("code", "scene_code"),
createStringCriterionOption("details"),
createStringCriterionOption("photographer"),
PathCriterionOption,
createStringCriterionOption("checksum", "media_info.checksum"),
RatingCriterionOption,

View File

@@ -195,5 +195,6 @@ export type CriterionType =
| "scene_updated_at"
| "description"
| "code"
| "photographer"
| "disambiguation"
| "has_chapters";