summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--store/tag.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/store/tag.go b/store/tag.go
index 580cd12..1e92630 100644
--- a/store/tag.go
+++ b/store/tag.go
@@ -125,15 +125,12 @@ func (s *Store) TagInfo(tag string) Tag {
return Tag{}
}
-// TagType sets type of a tag.
+// TagType sets type of tag.
func (s *Store) TagType(tag, t string) {
if !nameRegex.MatchString(tag) || !s.file(s.TagMetadataPath(tag)) {
return
}
- s.getLock("tag_" + tag).Lock()
- defer s.getLock("tag_" + tag).Unlock()
-
if t != ArtistType &&
t != CharacterType &&
t != CopyrightType &&
@@ -144,6 +141,10 @@ func (s *Store) TagType(tag, t string) {
return
}
info := s.TagInfo(tag)
+
+ s.getLock("tag_" + tag).Lock()
+ defer s.getLock("tag_" + tag).Unlock()
+
info.Type = t
if payload, err := json.Marshal(info); err != nil {
s.fatalClose(fmt.Sprintf("Error updating tag %s metadata, %s", tag, err))