Files
server-ops/daily/2026-06-20.md

52 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 2026-06-20 有声书服务全线搭建
## Audiobookshelf 章节排序三层同步铁律
只改文件名不生效Audiobookshelf 按三层数据排序:
| 层 | 字段 | 规则 |
|:---|:---|:---|
| 文件系统 | 文件名 `01-标题.mp3` | 数字前缀 |
| books.chapters | `start`(秒) | 必须连续递增 |
| books.audioFiles | `index` | 必须 1→2→3→... |
## 完整下载→归档工作流
```
yt-dlp 下载(带 --print upload_date)
→ 按 upload_date 排序 → 加 01-N 前缀
→ 放入 audiobooks/节目名/
→ archive_old_audio.sh <节目> 3 (淘汰旧集到 archive_pending/)
→ sync_archive.sh (SCP到 D:/服务器备份/有声书/)
→ watcher 自动检测 → 希声同步
```
## 服务架构
| 组件 | 位置 |
|:---|:---|
| Audiobookshelf | podcast.xybkwd.top :13378 |
| 滚动保留 | 每节目 3 集 |
| 待归档 | /home/ubuntu/audiobookshelf/archive_pending/ |
| 本地归档 | D:/服务器备份/有声书/ (392G 可用) |
| 淘汰脚本 | /home/ubuntu/audiobookshelf/scripts/archive_old_audio.sh |
| 同步脚本 | D:/服务器备份/有声书/sync_archive.sh |
## 踩坑记录
1. 数据库误删 - 未先问用户,教训:任何 DB/cache 操作必须先确认
2. 章节排序 - 不是靠文件名字母序,是靠 chapters[].start 时间戳
3. SCP 中文路径 - 含空格的目录需用临时路径中转
4. 容器无需频繁重启 - Audiobookshelf watcher 自动检测文件变化
5. B站无纯音频流 - 用 `-f worstvideo+worstaudio/worst` 最小化下载量(每集 ~40MB)
6. Gitea 凭证 - 固定为 beast API token: `bb731ed7d0d267b98a1c7d082de6c8fc0329ac21`
## 当前内容
| 节目 | 集数 | 来源 |
|:---|:---|:---|
| 渤海小吏·八王之乱 | 5集 | B站 |
| 纵横四海 | 3集 | B站 |
| 翟东升 | 3集 | YouTube |
| Elon Musk | 99集 | 本地导入 |