beet-observer 0.5.0__tar.gz → 0.6.1__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {beet_observer-0.5.0 → beet_observer-0.6.1}/PKG-INFO +1 -1
- {beet_observer-0.5.0 → beet_observer-0.6.1}/beet_observer/__init__.py +1 -1
- {beet_observer-0.5.0 → beet_observer-0.6.1}/beet_observer/data_pack.py +0 -5
- {beet_observer-0.5.0 → beet_observer-0.6.1}/beet_observer/plugin.py +36 -6
- {beet_observer-0.5.0 → beet_observer-0.6.1}/beet_observer/resource_pack.py +0 -5
- {beet_observer-0.5.0 → beet_observer-0.6.1}/pyproject.toml +1 -1
- {beet_observer-0.5.0 → beet_observer-0.6.1}/LICENSE +0 -0
- {beet_observer-0.5.0 → beet_observer-0.6.1}/README.md +0 -0
@@ -124,11 +124,6 @@ def gen_dp_overlays(
|
|
124
124
|
continue
|
125
125
|
# check if it's the top-level overlay
|
126
126
|
if overlay == ctx.meta["observer"]["default_dir_dp"]:
|
127
|
-
# delete pack.mcmeta from overlay (required for tests)
|
128
|
-
default_dir = ctx.meta["observer"]["default_dir_dp"]
|
129
|
-
if ctx.data.overlays[default_dir].mcmeta:
|
130
|
-
del ctx.data.overlays[default_dir].mcmeta
|
131
|
-
|
132
127
|
# get pack format from build context
|
133
128
|
if "default_format" in ctx.meta["observer"]:
|
134
129
|
formats = ctx.meta["observer"]["default_format"]
|
@@ -7,6 +7,26 @@ from .resource_pack import *
|
|
7
7
|
def beet_default(ctx: Context):
|
8
8
|
if "observer" not in ctx.meta:
|
9
9
|
return
|
10
|
+
|
11
|
+
# # check cache
|
12
|
+
cache = ctx.cache["observer"]
|
13
|
+
cached_dp = False
|
14
|
+
cached_rp = False
|
15
|
+
dp_path = None
|
16
|
+
rp_path = None
|
17
|
+
if ctx.data:
|
18
|
+
dp_path = cache.get_path(f"{ctx.directory} saved_data_pack")
|
19
|
+
if dp_path.is_dir():
|
20
|
+
ctx.data.load(f"{dp_path}")
|
21
|
+
cached_dp = True
|
22
|
+
if ctx.assets:
|
23
|
+
rp_path = cache.get_path(f"{ctx.directory} saved_resource_pack")
|
24
|
+
if rp_path.is_dir():
|
25
|
+
ctx.assets.load(f"{rp_path}")
|
26
|
+
cached_rp = True
|
27
|
+
if cached_dp and cached_rp:
|
28
|
+
return
|
29
|
+
|
10
30
|
# get default directories
|
11
31
|
if "default_dir" not in ctx.meta["observer"]:
|
12
32
|
# default dir not defined
|
@@ -30,12 +50,14 @@ def beet_default(ctx: Context):
|
|
30
50
|
save.append(overlay)
|
31
51
|
# loop through all overlays
|
32
52
|
for overlay in ctx.meta["observer"]["overlays"]:
|
33
|
-
#
|
34
|
-
|
53
|
+
# get pack
|
54
|
+
if overlay["process"].startswith("https://"):
|
55
|
+
load = overlay["process"]
|
56
|
+
else:
|
57
|
+
load = f"{ctx.directory}/{overlay['process']}"
|
35
58
|
# generate context for overlay pack
|
36
59
|
with run_beet(
|
37
|
-
config={"data_pack": {"load":
|
38
|
-
directory=path,
|
60
|
+
config={"data_pack": {"load": load}, "resource_pack": {"load": load}}
|
39
61
|
) as ctx_overlay:
|
40
62
|
if "directory" not in overlay:
|
41
63
|
dp_dir = f"overlay_{ctx_overlay.data.pack_format}"
|
@@ -44,5 +66,13 @@ def beet_default(ctx: Context):
|
|
44
66
|
dp_dir = overlay["directory"]
|
45
67
|
rp_dir = overlay["directory"]
|
46
68
|
# compare build pack and overlay pack
|
47
|
-
|
48
|
-
|
69
|
+
if not cached_dp and ctx.data:
|
70
|
+
gen_dp_overlays(ctx, ctx_overlay, dp_dir, save)
|
71
|
+
if not cached_rp and ctx.assets:
|
72
|
+
gen_rp_overlays(ctx, ctx_overlay, rp_dir, save)
|
73
|
+
|
74
|
+
# save to cache
|
75
|
+
if not cached_dp and ctx.data:
|
76
|
+
ctx.data.save(path=dp_path)
|
77
|
+
if not cached_rp and ctx.assets:
|
78
|
+
ctx.assets.save(path=rp_path)
|
@@ -52,11 +52,6 @@ def gen_rp_overlays(
|
|
52
52
|
continue
|
53
53
|
# check if it's the top-level overlay
|
54
54
|
if overlay == ctx.meta["observer"]["default_dir_rp"]:
|
55
|
-
# delete pack.mcmeta from overlay (required for tests)
|
56
|
-
default_dir = ctx.meta["observer"]["default_dir_rp"]
|
57
|
-
if ctx.assets.overlays[default_dir].mcmeta:
|
58
|
-
del ctx.assets.overlays[default_dir].mcmeta
|
59
|
-
|
60
55
|
# get pack format from build context
|
61
56
|
if "default_format" in ctx.meta["observer"]:
|
62
57
|
formats = ctx.meta["observer"]["default_format"]
|
File without changes
|
File without changes
|