@chenhao6682108/dsh-skill-musicbee 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -67,7 +67,8 @@ and keep the rule fields (`req`, `ending`, `body`, `share`, `long_sec`, `no_repe
67
67
  message names the exact next command to run. `playlists_dir` and `prefix_mbp` are **optional in the
68
68
  config**: `party_build.py` reads MusicBee's own `Playlists` folder from `<ENV_LibPath>` and picks a
69
69
  same-library `.mbp` for the 52-byte header, so only `library_root` (the folder whose subfolders are the
70
- style names) has to be written by hand.
70
+ style names) has to be written by hand. A same-name `.mbp` (or `.md`) is **overwritten in place** —
71
+ the run prints a line first — so keep a copy of `Playlists` if you want to keep old versions.
71
72
 
72
73
  ## How it works
73
74
 
package/README.zh.md CHANGED
@@ -58,7 +58,8 @@ scripts\mb-doctor.cmd -Json :: 给程序读的 JSON
58
58
  规则字段(`req`、`ending`、`body`、`share`、`long_sec`、`no_repeat_style`、`ballroom_gap_max`)原样保留。
59
59
  `party_build.py -h` 会列出所有可用字段;每条报错都会写清楚下一步该跑什么命令。
60
60
  `playlists_dir` 和 `prefix_mbp` 现在可以**整个省略**:`party_build.py` 从 `<ENV_LibPath>` 读到 MusicBee 的
61
- `Playlists` 目录,并自动挑一个同库 `.mbp` 取 52 字节文件头——手写只剩 `library_root`(风格子目录的父目录)。
61
+ `Playlists` 目录,并自动挑一个同库 `.mbp` 取 52 字节文件头——手写只剩 `library_root`(风格子目录的父目录)。同名 `.mbp`(或 `.md`)会被**直接覆盖**(运行时先打印一行提示),
62
+ 想保留旧版本就先备份 `Playlists`。
62
63
 
63
64
  ## 实现方式
64
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chenhao6682108/dsh-skill-musicbee",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "MusicBee playlist and library toolkit as a DSH skill plugin: scan a music library into a JSON index, write ID3/Vorbis/MP4 tags, build validated dsh (3dj) party playlists, rewrite and remap .mbp playlist files, and make MusicBee re-read them. Ships mb-doctor to auto-detect the MusicBee library, Playlists folder and Python. Windows and a local MusicBee install required; no network access and no audio data is modified.",
5
5
  "keywords": [
6
6
  "deepseek",
@@ -361,7 +361,7 @@ scripts\restart-musicbee.cmd
361
361
  | 字段 | 说明 |
362
362
  |---|---|
363
363
  | `index` / `library_root` | 索引 JSON 与 1blues 根目录(按子目录判风格) |
364
- | `playlists_dir` / `prefix_mbp` / `out_mbp` | Playlists 根(**可省略,自动从 MusicBee 设置取**)、52 字节头来源(**可省略,自动挑同库 .mbp**)、输出 .mbp(相对路径按 Playlists 解析) |
364
+ | `playlists_dir` / `prefix_mbp` / `out_mbp` | Playlists 根(**可省略,自动从 MusicBee 设置取**)、52 字节头来源(**可省略,自动挑同库 .mbp**)、输出 .mbp(相对路径按 Playlists 解析);**同名 `.mbp` 会被直接覆盖**,运行时会先打印一行提示 |
365
365
  | `name` / `start` | 歌单名(= 文件名)、开始时间 `"22:30"` |
366
366
  | `styles` / `req` / `body` | 可能用到的风格池、固定配额(风格→首数)、其余曲目允许的风格 |
367
367
  | `set` | 播放顺序曲目表,每行 `[风格, 艺人片段, 标题, 能量H/M/L, 理由, 段落]`;标题须与索引一致 |
@@ -210,6 +210,7 @@ def auto_prefix_mbp(playlists_dir):
210
210
  return ""
211
211
 
212
212
 
213
+ # ---------------------------------------------------------------- 校验
213
214
  def run(cfg):
214
215
  need = ["index", "out_mbp", "name", "styles", "req", "body", "set"]
215
216
  missing = [k for k in need if k not in cfg]
@@ -421,18 +422,22 @@ def run(cfg):
421
422
  print("排除曲目: " + ("无" if not excl_details else
422
423
  " + ".join(f"{os.path.basename(f)} {c} 首" for f, c in excl_details)))
423
424
 
424
- # 写 .mbp
425
+ # 写 .mbp(同名文件直接覆盖,但打印提示,不静默)
425
426
  prefix = cfg["prefix_mbp"]
426
427
  if not os.path.isabs(prefix):
427
428
  prefix = os.path.join(cfg["playlists_dir"], prefix)
428
429
  if not os.path.exists(prefix):
429
430
  die("取不到 52 字节文件头,来源 .mbp 不存在:" + prefix +
430
431
  "\n prefix_mbp 要指向 <playlists_dir> 下任意一个同库 .mbp(例如 \"1blues/ballroomin.mbp\")")
432
+ if os.path.exists(cfg["out_mbp"]):
433
+ print("目标歌单已存在,覆盖:" + cfg["out_mbp"])
431
434
  size = write_mbp(prefix, cfg["out_mbp"], paths)
432
435
  print(f"wrote {cfg['out_mbp']} {size} bytes round-trip OK")
433
436
 
434
- # 写分享说明
437
+ # 写分享说明(同样覆盖同名文件)
435
438
  if cfg.get("out_md"):
439
+ if os.path.exists(cfg["out_md"]):
440
+ print("说明文件已存在,覆盖:" + cfg["out_md"])
436
441
  write_md(cfg, stats)
437
442
  print("wrote " + cfg["out_md"])
438
443