Bash 标记 mp3 文件的脚本
Bash script to tag mp3 files
我想编辑很多 .mp3
文件的元数据。我不想使用 GUI 或任何手动的一对一方式来执行此操作。我想写一个脚本来为我添加标签。我正在寻找手动编辑元数据的命令或方式,以便我可以编写如下内容:
for SONG in ./songs/greenday/*
do
tag --artist="greenday" --album="Dookie" --album-art="./art/greenday/Dookie.jpg" --file $SONG
done
我熟悉以下工具:
- Kid3
- EasyTAG
- Mp3tag
但是none允许我以我想要的高效方式做我想做的事。
我搜索了 debian 软件包,有一个名为 kid3-cli 的软件包
你可以阅读手册man kid3-cli
Kid3 可以编写复杂的 ID3v2 和 v3 标签,其中包含更多的封面。此示例标记文件夹中的所有歌曲
kid3-cli -c "set title 'I\'ll be there for you'" \
-c "set albumart 'http://www.example.com/blah.jpg'" \
-c "set SYLT:'/path/to/lyrics.lrc'" \
./songs/greenday/*.mp3
记住这只是一个例子,再痛也要看男人
现在完全不同
如果您不需要封面艺术,您可以使用带有 can tag straight ID3v1 标签的 mp3tag
#!/bin/bash
for SONG in ./songs/greenday/*
do
mp3tag -a "greenday" -l "Dookie" "$SONG"
done
...我已经测试过了,有效
max@linux:~# ./testmp3
Wrote ID3 tag successfully!
/root/musik/Brett Eldredge- Brett Eldredge_Love Someone.mp3
-----------------------------------------------------------
Artist : greenday
Songname :
Album : Dookie Year:
Etcetera :
Genre : (null)
Info : Mpeg-1 layer 3 at 44100Hz, 128kb/s (JointStereo)
Wrote ID3 tag successfully!
/root/musik/Brett Eldredge- Brett Eldredge_Somethin' I'm Good At.mp3
--------------------------------------------------------------------
Artist : greenday
Songname :
Album : Dookie Year:
Etcetera :
Genre : (null)
Info : Mpeg-1 layer 3 at 48000Hz, 64kb/s (JointStereo)
Wrote ID3 tag successfully!
/root/musik/Brett Eldredge- Brett Eldredge_The Long Way.mp3
-----------------------------------------------------------
Artist : greenday
Songname :
Album : Dookie Year:
Etcetera :
Genre : (null)
Info : Mpeg-1 layer 3 at 44100Hz, 128kb/s (JointStereo)
Wrote ID3 tag successfully!
/root/musik/Brett Eldredge- Brett Eldredge_The Reason.mp3
---------------------------------------------------------
Artist : greenday
Songname :
Album : Dookie Year:
Etcetera :
Genre : (null)
Info : Mpeg-1 layer 3 at 44100Hz, 128kb/s (JointStereo)
Wrote ID3 tag successfully!
/root/musik/Brett Eldredge- Bring You Back_Don't Ya.mp3
-------------------------------------------------------
Artist : greenday
Songname :
Album : Dookie Year:
Etcetera :
Genre : (null)
Info : Mpeg-1 layer 3 at 44100Hz, 128kb/s (JointStereo)
Wrote ID3 tag successfully!
/root/musik/Brett Eldredge- Illinois_Drunk On Your Love.mp3
-----------------------------------------------------------
Artist : greenday
Songname :
Album : Dookie Year:
Etcetera :
Genre : (null)
Info : Mpeg-1 layer 3 at 44100Hz, 128kb/s (JointStereo)
Wrote ID3 tag successfully!
/root/musik/Brett Eldredge- Lose My Mind_Lose My Mind.mp3
---------------------------------------------------------
Artist : greenday
Songname :
Album : Dookie Year:
Etcetera :
Genre : (null)
Info : Mpeg-1 layer 3 at 44100Hz, 128kb/s (JointStereo)
我想编辑很多 .mp3
文件的元数据。我不想使用 GUI 或任何手动的一对一方式来执行此操作。我想写一个脚本来为我添加标签。我正在寻找手动编辑元数据的命令或方式,以便我可以编写如下内容:
for SONG in ./songs/greenday/*
do
tag --artist="greenday" --album="Dookie" --album-art="./art/greenday/Dookie.jpg" --file $SONG
done
我熟悉以下工具:
- Kid3
- EasyTAG
- Mp3tag
但是none允许我以我想要的高效方式做我想做的事。
我搜索了 debian 软件包,有一个名为 kid3-cli 的软件包
你可以阅读手册man kid3-cli
Kid3 可以编写复杂的 ID3v2 和 v3 标签,其中包含更多的封面。此示例标记文件夹中的所有歌曲
kid3-cli -c "set title 'I\'ll be there for you'" \
-c "set albumart 'http://www.example.com/blah.jpg'" \
-c "set SYLT:'/path/to/lyrics.lrc'" \
./songs/greenday/*.mp3
记住这只是一个例子,再痛也要看男人
现在完全不同
如果您不需要封面艺术,您可以使用带有 can tag straight ID3v1 标签的 mp3tag
#!/bin/bash
for SONG in ./songs/greenday/*
do
mp3tag -a "greenday" -l "Dookie" "$SONG"
done
...我已经测试过了,有效
max@linux:~# ./testmp3 Wrote ID3 tag successfully! /root/musik/Brett Eldredge- Brett Eldredge_Love Someone.mp3 ----------------------------------------------------------- Artist : greenday Songname : Album : Dookie Year: Etcetera : Genre : (null) Info : Mpeg-1 layer 3 at 44100Hz, 128kb/s (JointStereo) Wrote ID3 tag successfully! /root/musik/Brett Eldredge- Brett Eldredge_Somethin' I'm Good At.mp3 -------------------------------------------------------------------- Artist : greenday Songname : Album : Dookie Year: Etcetera : Genre : (null) Info : Mpeg-1 layer 3 at 48000Hz, 64kb/s (JointStereo) Wrote ID3 tag successfully! /root/musik/Brett Eldredge- Brett Eldredge_The Long Way.mp3 ----------------------------------------------------------- Artist : greenday Songname : Album : Dookie Year: Etcetera : Genre : (null) Info : Mpeg-1 layer 3 at 44100Hz, 128kb/s (JointStereo) Wrote ID3 tag successfully! /root/musik/Brett Eldredge- Brett Eldredge_The Reason.mp3 --------------------------------------------------------- Artist : greenday Songname : Album : Dookie Year: Etcetera : Genre : (null) Info : Mpeg-1 layer 3 at 44100Hz, 128kb/s (JointStereo) Wrote ID3 tag successfully! /root/musik/Brett Eldredge- Bring You Back_Don't Ya.mp3 ------------------------------------------------------- Artist : greenday Songname : Album : Dookie Year: Etcetera : Genre : (null) Info : Mpeg-1 layer 3 at 44100Hz, 128kb/s (JointStereo) Wrote ID3 tag successfully! /root/musik/Brett Eldredge- Illinois_Drunk On Your Love.mp3 ----------------------------------------------------------- Artist : greenday Songname : Album : Dookie Year: Etcetera : Genre : (null) Info : Mpeg-1 layer 3 at 44100Hz, 128kb/s (JointStereo) Wrote ID3 tag successfully! /root/musik/Brett Eldredge- Lose My Mind_Lose My Mind.mp3 --------------------------------------------------------- Artist : greenday Songname : Album : Dookie Year: Etcetera : Genre : (null) Info : Mpeg-1 layer 3 at 44100Hz, 128kb/s (JointStereo)