Skip to content

Commit

Permalink
fix: merge files from auto_yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
vberlier committed Jan 22, 2022
1 parent c3083a4 commit 766ab0e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
6 changes: 3 additions & 3 deletions beet/contrib/auto_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class AutoYamlNamespaceHandler(YamlFile, NamespaceFile):

def bind(self, pack: Any, path: str):
super().bind(pack, path)
pack[path] = file_type(dump_json(self.data))
pack[file_type].merge({path: file_type(dump_json(self.data))})
raise Drop()

return AutoYamlNamespaceHandler
Expand All @@ -76,7 +76,7 @@ def create_extra_handler(
class AutoYamlExtraHandler(YamlFile):
def bind(self, pack: Any, path: str):
super().bind(pack, path)
pack.extra[filename] = file_type(dump_json(self.data))
pack.extra.merge({filename: file_type(dump_json(self.data))})
raise Drop()

return AutoYamlExtraHandler
Expand All @@ -92,7 +92,7 @@ class AutoYamlExtraHandler(YamlFile):
def bind(self, pack: Any, path: str):
super().bind(pack, path)
namespace, _, path = path.partition(":")
pack[namespace].extra[filename] = file_type(dump_json(self.data))
pack[namespace].extra.merge({filename: file_type(dump_json(self.data))})
raise Drop()

return AutoYamlExtraHandler
2 changes: 1 addition & 1 deletion examples/load_auto_yaml/beet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ require:
- demo.installation_message
- beet.contrib.auto_yaml
data_pack:
load: [src]
load: [src, other]
resource_pack:
load: [src]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
values:
- demo:f2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
values:
- demo:f1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"demo:f1",
"demo:f2"
]
}

0 comments on commit 766ab0e

Please sign in to comment.