Hiero: tag should use deepcopy for metadata

This commit is contained in:
Jakub Jezek 2022-05-20 12:59:38 +02:00
parent 90948931b0
commit 7c3fdcc633
No known key found for this signature in database
GPG key ID: 730D7C02726179A7
2 changed files with 5 additions and 4 deletions

View file

@ -3,6 +3,7 @@ Host specific functions where host api is connected
"""
import contextlib
from copy import deepcopy
import os
import re
import sys
@ -288,7 +289,7 @@ def get_track_item_pype_tag(track_item):
return None
for tag in _tags:
# return only correct tag defined by global name
if tag.name() in self.pype_tag_name:
if tag.name() == self.pype_tag_name:
return tag
@ -344,9 +345,9 @@ def get_track_item_pype_data(track_item):
return None
# get tag metadata attribute
tag_data = tag.metadata()
tag_data = deepcopy(dict(tag.metadata()))
# convert tag metadata to normal keys names and values to correct types
for k, v in dict(tag_data).items():
for k, v in tag_data.items():
key = k.replace("tag.", "")
try:

View file

@ -86,7 +86,7 @@ def update_tag(tag, data):
# due to hiero bug we have to make sure keys which are not existent in
# data are cleared of value by `None`
for _mk in mtd.keys():
for _mk in mtd.dict().keys():
if _mk.replace("tag.", "") not in data_mtd.keys():
mtd.setValue(_mk, str(None))