func ScrapedStudio(qb models.StudioReader, s *models.ScrapedStudio, stashBoxEndpoint *string) error {
	if s.StoredID != nil {
		return nil
	}

	// Check if a studio with the StashID already exists
	if stashBoxEndpoint != nil && s.RemoteSiteID != nil {
		studios, err := qb.FindByStashID(models.StashID{
			StashID:  *s.RemoteSiteID,
			Endpoint: *stashBoxEndpoint,
		})
		if err != nil {
			return err
		}
		if len(studios) > 0 {
			id := strconv.Itoa(studios[0].ID)
			s.StoredID = &id
			return nil
		}
	}

	st, err := studio.ByName(qb, s.Name)

	if err != nil {
		return err
	}

	if st == nil {
		// try matching by alias
		st, err = studio.ByAlias(qb, s.Name)
		if err != nil {
			return err
		}
	}

	if st == nil {
		// ignore - cannot match
		return nil
	}

	id := strconv.Itoa(st.ID)
	s.StoredID = &id
	return nil
}
// ScrapedStudio matches the provided studio with the studios
// in the database and sets the ID field if one is found.
ScrapedStudio matches the provided studio with the studios
in the database and sets the ID field if one is found.
// ScrapedStudio matches the provided studio with the studios // in the database and sets the ID field if one is found .
func ScrapedStudio(qb models.StudioReader, s *models.ScrapedStudio, stashBoxEndpoint *string) error {
	if s.StoredID != nil {
		return nil
	}
	if stashBoxEndpoint != nil && s.RemoteSiteID != nil {
		studios, err := qb.FindByStashID(models.StashID{
			StashID:  *s.RemoteSiteID,
			Endpoint: *stashBoxEndpoint,
		})
		if err != nil {
			return err
		}
		if len(studios) > 0 {
			id := strconv.Itoa(studios[0].ID)
			s.StoredID = &id
			return nil
		}
	}
	st, err := studio.ByName(qb, s.Name)
	if err != nil {
		return err
	}
	if st == nil {
		st, err = studio.ByAlias(qb, s.Name)
		if err != nil {
			return err
		}
	}
	if st == nil {
		return nil
	}
	id := strconv.Itoa(st.ID)
	s.StoredID = &id
	return nil
}
func ScrapedStudio ( qb models . StudioReader , s * models . ScrapedStudio , stashBoxEndpoint * string ) error { if s . StoredID != nil { return nil } if stashBoxEndpoint != nil && s . RemoteSiteID != nil { studios , err := qb . FindByStashID ( models . StashID { StashID : * s . RemoteSiteID , Endpoint : * stashBoxEndpoint , } ) if err != nil { return err } if len ( studios ) > 0 { id := strconv . Itoa ( studios [ 0 ] . ID ) s . StoredID = & id return nil } } st , err := studio . ByName ( qb , s . Name ) if err != nil { return err } if st == nil { st , err = studio . ByAlias ( qb , s . Name ) if err != nil { return err } } if st == nil { return nil } id := strconv . Itoa ( st . ID ) s . StoredID = & id return nil }
ScrapedStudio matches the provided studio with the studios
in the database and sets the ID field if one is found.
ScrapedStudio matches the provided studio with the studios in the database and sets the ID field if one is found .
// Check if a studio with the StashID already exists // try matching by alias // ignore - cannot match