简单的蟒蛇3你好世界
RegexTagForMusic的Python项目详细描述
regextagformusic
regextagformusic是一个标记mp3文件的工具,使用regular expressions提取id3标记文件路径。换句话说,如果路径与regex匹配,则可以将任何匹配的组用作id3标记。
我最初开发了regextagformusic来使用eyeD3自动标记我的音乐。id3标记是一些元数据,就像您在文件系统中存储文件一样,所以我想要一种同步文件系统中标记的方法:
- album字段是文件的父文件夹
- artist字段是album文件夹的父文件夹
- trackNumber字段是文件名的第一个数字
- title字段是文件名的其余部分
安装
您可以使用pip从PyPI直接安装regextagformusic。
# Ensure pip is installed on the system $ sudo apt install python3-pip # You can install just for the current user $ pip install --user RegexTagForMusic # Or install it for all users $ sudo pip install RegexTagForMusic
您还可以从以下来源构建regextagformusic:
$ git clone https://github.com/essembeh/RegexTagForMusic
$ cd RegexTagForMusic
$ make
$ pip install --user dist/RegexTagForMusic-*.whl
试试看
见the default configuration file和samples documentation。
$ cd samples/config/default
$ tree
现在,使用配置文件中的筛选器验证是否可以识别所有文件:
$ rtfm --config ../default.json
还要检查过滤器中声明的所有属性:
$ rtfm --config ../default.json --verbose
命令^ {< CD1>}验证MP3文件中现有的标记与从文件路径提取的属性匹配:
$ rtfm --config ../default.json -x check
在我们的示例中,文件尚未标记,因此我们将标记它们:
$ rtfm --config ../default.json -x tag
clean
操作删除文件中的所有标记:
$ rtfm --config ../default.json -x clean
命令行选项和参数
$ rtfm --help
usage: rtfm [-h] [-v] [-c CONFIG] [-l LIBRARY] [-r ROOT] [--folders]
[-x ACTION] [-n] [--continue]
[FILE [FILE ...]]
Simple hello world python sample
positional arguments:
FILE files to process
optional arguments:
-h, --help show this help message and exit
-v, --verbose be more verbose
-c CONFIG, --config CONFIG
configuration file (default:
~/.config/rtfm.json
-l LIBRARY, --library LIBRARY
library file
-r ROOT, --root ROOT make all paths relative to given folder (default is
current folder, $PWD)
--folders also process folders
-x ACTION, --execute ACTION
action to perform
-n, --dryrun dryrun mode, do not modify files
--continue continue in case of error
配置文件
见sample configuration files和samples documentation