beet-observer 0.6.0__py3-none-any.whl → 0.6.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
beet_observer/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
- __version__ = "0.6.0"
1
+ __version__ = "0.6.1"
2
2
 
3
3
  from .plugin import *
@@ -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"]
beet_observer/plugin.py CHANGED
@@ -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
@@ -46,5 +66,13 @@ def beet_default(ctx: Context):
46
66
  dp_dir = overlay["directory"]
47
67
  rp_dir = overlay["directory"]
48
68
  # compare build pack and overlay pack
49
- gen_dp_overlays(ctx, ctx_overlay, dp_dir, save)
50
- gen_rp_overlays(ctx, ctx_overlay, rp_dir, save)
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"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: beet-observer
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: A beet plugin to automatically generate overlays from previous datapacks
5
5
  License: MIT
6
6
  Author: BPR02
@@ -0,0 +1,8 @@
1
+ beet_observer/__init__.py,sha256=L6JbkcXu2b4CMzeLNR5y21RMc46RINFYzzWYK5vgJNc,45
2
+ beet_observer/data_pack.py,sha256=JonYeQgjQGP5j6QWH0rTHRckrKAmEqnp1ajiOr1K9BY,9555
3
+ beet_observer/plugin.py,sha256=mtGBtJNCiUHkSGiAoRl7li0oIlZBQ-cuDS91bubDaPs,2835
4
+ beet_observer/resource_pack.py,sha256=ZO6Ye-_17IAx5rvsht6Gd3IY10ZtevoOX20mZwxzWnk,5984
5
+ beet_observer-0.6.1.dist-info/LICENSE,sha256=oBbP6j7sgG9darFSRZxV7iO8yPR1aZiDspSK3mcLpXI,1062
6
+ beet_observer-0.6.1.dist-info/METADATA,sha256=CZ-tu7EjlToxxmbi0loJZt8t-g2ViZRXr1eRx5wLY4g,674
7
+ beet_observer-0.6.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
8
+ beet_observer-0.6.1.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- beet_observer/__init__.py,sha256=1Bu06DCGzyW6_EOuOSqpm31Fvkl_thjvyH54vN4XjZ4,45
2
- beet_observer/data_pack.py,sha256=QqoyQYiCBpqioaKYSUKANgd3dxJJFLGka92G3Tyz_Js,9800
3
- beet_observer/plugin.py,sha256=YBxXXzWGGVKqJHTuYi9a3KQO6-E841OS3iHcTnKXg_s,2011
4
- beet_observer/resource_pack.py,sha256=_a4Ubx8fO7HMnIbfQlsnYEIM_Vjo3o_QjarirqbWdkc,6233
5
- beet_observer-0.6.0.dist-info/LICENSE,sha256=oBbP6j7sgG9darFSRZxV7iO8yPR1aZiDspSK3mcLpXI,1062
6
- beet_observer-0.6.0.dist-info/METADATA,sha256=kgd3ISGBKRueQuQvvapeouk5auWa2FB4oldNV4vKW3w,674
7
- beet_observer-0.6.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
8
- beet_observer-0.6.0.dist-info/RECORD,,