4 个版本
0.10.1 | 2024 年 6 月 17 日 |
---|
#104 in 音频
200KB
5K SLoC
caesura 𝄓
一个多功能命令行工具,用于自动将 FLAC 或 FLAC 24 位源种子转换为 MP3 320 (CBR) 和 MP3 V0 (VBR),然后上传到基于 gazelle 的追踪器。
特性
支持所有基于 gazelle 的索引器/追踪器
- RED
- [wip] OPS。
已在 Linux 上测试,理论上在 Windows 上也能工作。
完全可配置,如果您认为某些内容应该是可配置的,请在 GitHub 上提交问题。
源验证
每个源都经过验证,确保它是
- 无损 FLAC
- 不是场景或有损发布
- 文件与种子哈希匹配
- 设置了艺术家、专辑、标题和曲目编号的音频标签
- [fixed] 黑胶唱片曲目编号
- 支持采样率和声道
频谱图生成
- 生成完整和缩放的频谱图以供审查
转码
- [fixed] 支持多线程转码,可选 CPU 限制
- 支持 FLAC 和 FLAC 24 位源
- 目标格式为 FLAC、MP3 320 (CBR) 和 MP3 V0 (VBR)
- 跳过现有格式
- [fixed] 完全支持嵌套子目录(即 CD1、CD2 等)
- [fixed] 自动命名,遵循既定约定,并解码 HTML 实体
- [fixed] 较短的文件名。
- 自动创建种子文件
- [new] 包括根目录中的图像,忽略所有其他文件。
- [new] 大于 750 KB 的图像(可选)压缩,转换为 JPG 并减少到小于 1920 px。
逻辑是包括文件夹和封面图像,以最大程度地减少文件大小,但对于艺术作品和其他附加内容,可以下载原始源。
上传
- 将转码文件复制到内容目录
- 将种子文件复制到客户端自动添加目录
批量
- [new] 从目录中的每个种子文件验证、转码和上传。
应用程序将遍历您的种子目录,并自动确定哪些 FLAC 源适合转码。
入门指南
最快的运行路径是使用docker compose,但这需要您对docker有一定的了解。但带来的好处是可重复性和通过隔离带来的安心。
安装
Docker
- 构建
docker build -t caesura .
- 运行
docker run \
--user 1000:1000 \
-v ./path/to/your/config.json:/app/config.json \
-v /path/to/your/data:/data \
caesura verify "123456"
Docker Compose
docker compose run caesura verify "123456"
Linux
cargo install imdl
- 安装FLAC、LAME、SOX和ImageMagick
sudo apt install flac lame sox imagemagick --yes
- 安装caesura
cargo install caesura
Windows
待确认
目前建议使用docker运行。
CLI命令
验证源
验证FLAC源是否适合转码。
caesura verify [OPTIONS] [SOURCE]
caesura verify--帮助
Usage: caesura verify [OPTIONS] [SOURCE]
Arguments:
[SOURCE]
Source as: torrent id, path to torrent file, or indexer url.
Examples: 4871992, path/to/something.torrent, https://example.com/torrents.php?id=2259978&torrentid=4871992#torrent4871992, or https://example.com/torrents.php?torrentid=4871992
Options:
--api-key <API_KEY>
API key
--indexer <INDEXER>
ID of the tracker as it appears in the source field of a torrent. Examples: red, pth, ops; Default: red
--indexer-url <INDEXER_URL>
URL of the indexer. Examples: https://redacted.ch, https://orpheus.network; Default: Dependent on indexer
--tracker-url <TRACKER_URL>
URL of the tracker. Examples: https://flacsfor.me, https://home.opsfet.ch; Default: Dependent on indexer
--content-directory <CONTENT_DIRECTORY>
Directory containing torrent content. Typically this is set as the download directory in your torrent client
--cpus <CPUS>
Number of cpus to use for processing. Default: Total number of CPUs
--verbosity <VERBOSITY>
Level of logs to display. Default: info
[possible values: silent, error, warn, info, debug, trace]
--config-path <CONFIG_PATH>
Path to the configuration file. Default: config.json (in current working directory)
--output <OUTPUT>
Directory where transcodes and spectrograms will be written
--target <TARGET>
Target formats. Default: flac, 320, and v0
[possible values: flac, 320, v0]
--allow-existing
Allow transcoding to existing formats
--skip-hash-check
Should the torrent hash check of existing files be skipped?
--hard-link
Use hard links when copying files
--compress-images
Should images greater than 750 KB be compressed?
-h, --help
Print help (see a summary with '-h')
生成频谱图
为FLAC源的每个轨道生成频谱图。
caesura spectrogram [OPTIONS] [SOURCE]
caesura spectrogram--帮助
Usage: caesura spectrogram [OPTIONS] [SOURCE]
Arguments:
[SOURCE]
Source as: torrent id, path to torrent file, or indexer url.
Examples: 4871992, path/to/something.torrent, https://example.com/torrents.php?id=2259978&torrentid=4871992#torrent4871992, or https://example.com/torrents.php?torrentid=4871992
Options:
--api-key <API_KEY>
API key
--indexer <INDEXER>
ID of the tracker as it appears in the source field of a torrent. Examples: red, pth, ops; Default: red
--indexer-url <INDEXER_URL>
URL of the indexer. Examples: https://redacted.ch, https://orpheus.network; Default: Dependent on indexer
--tracker-url <TRACKER_URL>
URL of the tracker. Examples: https://flacsfor.me, https://home.opsfet.ch; Default: Dependent on indexer
--content-directory <CONTENT_DIRECTORY>
Directory containing torrent content. Typically this is set as the download directory in your torrent client
--cpus <CPUS>
Number of cpus to use for processing. Default: Total number of CPUs
--verbosity <VERBOSITY>
Level of logs to display. Default: info
[possible values: silent, error, warn, info, debug, trace]
--config-path <CONFIG_PATH>
Path to the configuration file. Default: config.json (in current working directory)
--output <OUTPUT>
Directory where transcodes and spectrograms will be written
--spectrogram-size <SPECTROGRAM_SIZE>
Output directory to write spectrogram images to
[possible values: full, zoom]
-h, --help
Print help (see a summary with '-h')
转码FLAC
将FLAC源的每个轨道转码为目标格式。
caesura transcode [OPTIONS] [SOURCE]
caesura transcode--帮助
Usage: caesura transcode [OPTIONS] [SOURCE]
Arguments:
[SOURCE]
Source as: torrent id, path to torrent file, or indexer url.
Examples: 4871992, path/to/something.torrent, https://example.com/torrents.php?id=2259978&torrentid=4871992#torrent4871992, or https://example.com/torrents.php?torrentid=4871992
Options:
--api-key <API_KEY>
API key
--indexer <INDEXER>
ID of the tracker as it appears in the source field of a torrent. Examples: red, pth, ops; Default: red
--indexer-url <INDEXER_URL>
URL of the indexer. Examples: https://redacted.ch, https://orpheus.network; Default: Dependent on indexer
--tracker-url <TRACKER_URL>
URL of the tracker. Examples: https://flacsfor.me, https://home.opsfet.ch; Default: Dependent on indexer
--content-directory <CONTENT_DIRECTORY>
Directory containing torrent content. Typically this is set as the download directory in your torrent client
--cpus <CPUS>
Number of cpus to use for processing. Default: Total number of CPUs
--verbosity <VERBOSITY>
Level of logs to display. Default: info
[possible values: silent, error, warn, info, debug, trace]
--config-path <CONFIG_PATH>
Path to the configuration file. Default: config.json (in current working directory)
--output <OUTPUT>
Directory where transcodes and spectrograms will be written
--target <TARGET>
Target formats. Default: flac, 320, and v0
[possible values: flac, 320, v0]
--allow-existing
Allow transcoding to existing formats
--skip-hash-check
Should the torrent hash check of existing files be skipped?
--hard-link
Use hard links when copying files
--compress-images
Should images greater than 750 KB be compressed?
-h, --help
Print help (see a summary with '-h')
上传
上传FLAC源的转码文件。
caesura upload [OPTIONS] [SOURCE]
caesura upload--帮助
Usage: caesura upload [OPTIONS] [SOURCE]
Arguments:
[SOURCE]
Source as: torrent id, path to torrent file, or indexer url.
Examples: 4871992, path/to/something.torrent, https://example.com/torrents.php?id=2259978&torrentid=4871992#torrent4871992, or https://example.com/torrents.php?torrentid=4871992
Options:
--api-key <API_KEY>
API key
--indexer <INDEXER>
ID of the tracker as it appears in the source field of a torrent. Examples: red, pth, ops; Default: red
--indexer-url <INDEXER_URL>
URL of the indexer. Examples: https://redacted.ch, https://orpheus.network; Default: Dependent on indexer
--tracker-url <TRACKER_URL>
URL of the tracker. Examples: https://flacsfor.me, https://home.opsfet.ch; Default: Dependent on indexer
--content-directory <CONTENT_DIRECTORY>
Directory containing torrent content. Typically this is set as the download directory in your torrent client
--verbosity <VERBOSITY>
Level of logs to display. Default: info
[possible values: silent, error, warn, info, debug, trace]
--config-path <CONFIG_PATH>
Path to the configuration file. Default: config.json (in current working directory)
--output <OUTPUT>
Directory where transcodes and spectrograms will be written
--target <TARGET>
Target formats. Default: flac, 320, and v0
[possible values: flac, 320, v0]
--allow-existing
Allow transcoding to existing formats
--copy-transcode-to-content-dir
Should the transcoded files be copied to the content directory.
This should be enabled if you wish to auto-add to your torrent client.
--copy-torrent-to <COPY_TORRENT_TO>
Copy the torrent file to the provided directory.
This should be set if you wish to auto-add to your torrent client.
--hard-link
Use hard links when copying files
-h, --help
Print help (see a summary with '-h')
批量
从多个FLAC源在一个命令中验证、转码和上传。
caesura upload [OPTIONS] [SOURCE]
caesura upload--帮助
Usage: caesura batch [OPTIONS] [SOURCE]
Arguments:
[SOURCE]
Source as: path to directory of torrents.
Options:
--api-key <API_KEY>
API key
--indexer <INDEXER>
ID of the tracker as it appears in the source field of a torrent. Examples: red, pth, ops; Default: red
--indexer-url <INDEXER_URL>
URL of the indexer. Examples: https://redacted.ch, https://orpheus.network; Default: Dependent on indexer
--tracker-url <TRACKER_URL>
URL of the tracker. Examples: https://flacsfor.me, https://home.opsfet.ch; Default: Dependent on indexer
--content-directory <CONTENT_DIRECTORY>
Directory containing torrent content. Typically this is set as the download directory in your torrent client
--verbosity <VERBOSITY>
Level of logs to display. Default: info
[possible values: silent, error, warn, info, debug, trace]
--config-path <CONFIG_PATH>
Path to the configuration file. Default: config.json (in current working directory)
--output <OUTPUT>
Directory where transcodes and spectrograms will be written
--target <TARGET>
Target formats. Default: flac, 320, and v0
[possible values: flac, 320, v0]
--allow-existing
Allow transcoding to existing formats
--skip-hash-check
Should the torrent hash check of existing files be skipped?
--cpus <CPUS>
Number of cpus to use for processing. Default: Total number of CPUs
--spectrogram-size <SPECTROGRAM_SIZE>
Output directory to write spectrogram images to
[possible values: full, zoom]
--hard-link
Use hard links when copying files
--compress-images
Should images greater than 750 KB be compressed?
--png-to-jpg
Should png images be converted to jpg?
Only applied if the image is greated than 750 KB and `compress_images` is true.
--no-spectrogram
Should the spectrogram command be executed?
--no-upload
Should the upload command be executed?
-h, --help
Print help (see a summary with '-h')
配置
配置选项首先从命令行参数获取,然后从配置文件获取。
默认情况下,应用程序从当前工作目录加载config.json
,但可以使用--config-path <CONFIG_PATH>
CLI参数来覆盖。
大多数选项都有合理的默认值,因此所需的最小配置是
{
"api_key": "YOUR_API_KEY",
"output": "path/to/write/output",
"content_directory": "path/to/your/torrent/content_or_downloads"
}
完整配置
{
"api_key": "YOUR_API_KEY",
"indexer": "abc",
"indexer_url": "https://example.com",
"tracker_url": "https://tracker.example.com",
"content_directory": "path/to/your/torrent/content_or_downloads",
"cpus": 6,
"verbosity": "trace",
"output": "path/to/write/output",
"target": ["320", "v0", "flac"],
"allow_existing": false,
"skip_hash_check": false,
"hard_link": false,
"compress_images": false,
"spectrogram_size": ["full", "zoom"],
"copy_transcode_to_content_dir": false,
"copy_torrent_to": "path/to/copy/torrent",
"hard_link": false,
"source": "123456"
}
版本和更改
版本遵循语义版本控制2.0.0规范。
提交消息遵循常规提交规范。
版本和完整变更日志可通过GitHub版本获取。
历史
DevYukine完成了初始工作
并将其作为red_oxide发布,许可协议为MIT许可协议。
RogueOneEcho将该项目分叉以完成主要重构,修复了一些问题
,添加了新功能
并改进了日志记录和错误处理。分叉版本发布为caesura,许可协议为AGPL许可协议。
前MIT许可协议和当前AGPL许可协议之间的主要区别是,如果您打算分发代码的修改版本——即使是在服务器上运行——也必须在AGPL许可协议下提供修改后的源代码。
这通常被称为copyleft。其意图是确保利用这项开源工作的人也为开源社区做出贡献。
有关参与此项目的贡献者列表,请参阅。
依赖项
~16–29MB
~398K SLoC