mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Add tags to studios (#4858)
* Fix makeTagFilter mode * Remove studio_tags filter criterion This is handled by studios_filter. The support for this still needs to be added in the UI, so I have removed the criterion options in the short-term. --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -982,6 +982,7 @@ func (t *ExportTask) ExportStudios(ctx context.Context, workers int) {
|
||||
func (t *ExportTask) exportStudio(ctx context.Context, wg *sync.WaitGroup, jobChan <-chan *models.Studio) {
|
||||
defer wg.Done()
|
||||
|
||||
r := t.repository
|
||||
studioReader := t.repository.Studio
|
||||
|
||||
for s := range jobChan {
|
||||
@@ -992,6 +993,18 @@ func (t *ExportTask) exportStudio(ctx context.Context, wg *sync.WaitGroup, jobCh
|
||||
continue
|
||||
}
|
||||
|
||||
tags, err := r.Tag.FindByStudioID(ctx, s.ID)
|
||||
if err != nil {
|
||||
logger.Errorf("[studios] <%s> error getting studio tags: %s", s.Name, err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
newStudioJSON.Tags = tag.GetNames(tags)
|
||||
|
||||
if t.includeDependencies {
|
||||
t.tags.IDs = sliceutil.AppendUniques(t.tags.IDs, tag.GetIDs(tags))
|
||||
}
|
||||
|
||||
fn := newStudioJSON.Filename()
|
||||
|
||||
if err := t.json.saveStudio(fn, newStudioJSON); err != nil {
|
||||
|
||||
@@ -292,8 +292,11 @@ func (t *ImportTask) ImportStudios(ctx context.Context) {
|
||||
}
|
||||
|
||||
func (t *ImportTask) importStudio(ctx context.Context, studioJSON *jsonschema.Studio, pendingParent map[string][]*jsonschema.Studio) error {
|
||||
r := t.repository
|
||||
|
||||
importer := &studio.Importer{
|
||||
ReaderWriter: t.repository.Studio,
|
||||
TagWriter: r.Tag,
|
||||
Input: *studioJSON,
|
||||
MissingRefBehaviour: t.MissingRefBehaviour,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user