mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
336e5b25f0
@ -0,0 +1,63 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-11565-1.html)
|
||||
[#]: subject: (Why containers and Kubernetes have the potential to run almost anything)
|
||||
[#]: via: (https://opensource.com/article/19/6/kubernetes-potential-run-anything)
|
||||
[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux)
|
||||
|
||||
为什么容器和 Kubernetes 有潜力运行一切
|
||||
======
|
||||
|
||||
> 不仅可以部署简单的应用程序,还可以用 Kubernetes 运维器应对第 2 天运营。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/201911/12/011140mp75sd0ynppd77da.jpg)
|
||||
|
||||
在我的第一篇文章 [为什么说 Kubernetes 是一辆翻斗车][2] 中,我谈到了 Kubernetes 如何在定义、分享和运行应用程序方面很出色,类似于翻斗车在移动垃圾方面很出色。在第二篇中,[如何跨越 Kubernetes 学习曲线][3],我解释了 Kubernetes 的学习曲线实际上与运行任何生产环境中的应用程序的学习曲线相同,这确实比学习所有传统组件要容易(如负载均衡器、路由器、防火墙、交换机、集群软件、集群文件系统等)。这是 DevOps,是开发人员和运维人员之间的合作,用于指定事物在生产环境中的运行方式,这意味着双方都需要学习。在第三篇 [Kubernetes 基础:首先学习如何使用][4] 中,我重新设计了 Kubernetes 的学习框架,重点是驾驶翻斗车而不是制造或装备翻斗车。在第四篇文章 [帮助你驾驭 Kubernetes 的 4 个工具][5] 中,我分享了我喜爱的工具,这些工具可帮助你在 Kubernetes 中构建应用程序(驾驶翻斗车)。
|
||||
|
||||
在这最后一篇文章中,我会分享我为什么对在 Kubernetes 上运行应用程序的未来如此兴奋的原因。
|
||||
|
||||
从一开始,Kubernetes 就能够很好地运行基于 Web 的工作负载(容器化的)。Web 服务器、Java 和相关的应用程序服务器(PHP、Python等)之类的工作负载都可以正常工作。该平台处理诸如 DNS、负载平衡和 SSH(由 `kubectl exec` 取代)之类的支持服务。在我的职业生涯的大部分时间里,这些都是我在生产环境中运行的工作负载,因此,我立即意识到,除了 DevOps 之外,除了敏捷之外,使用 Kubernetes 运行生产环境工作负载的强大功能。即使是我们几乎不改变我们的文化习惯,也可以提高效率。调试和退役变得非常容易,而这对于传统 IT 来说是极为困难的。因此,从早期开始,Kubernetes 就用一种单一的配置语言(Kube YAML/Json)为我提供了对生产环境工作负载进行建模所需的所有基本原语。
|
||||
|
||||
但是,如果你需要运行具有复制功能的多主 MySQL,会发生什么情况?使用 Galera 的冗余数据呢?你如何进行快照和备份?那么像 SAP 这样复杂的工作呢?使用 Kubernetes,简单的应用程序(Web 服务器等)的第 0 天(部署)相当简单,但是没有解决第 2 天的运营和工作负载。这并不是说,具有复杂工作负载的第 2 天运营要比传统 IT 难解决,而是使用 Kubernetes 并没有使它们变得更容易。每个用户都要设计自己的天才想法来解决这些问题,这基本上是当今的现状。在过去的五年中,我遇到的第一类问题是复杂工作负载的第 2 天操作。(LCTT 译注:在软件生命周期中,第 0 天是指软件的设计阶段;第 1 天是指软件的开发和部署阶段;第 2 天是指生产环境中的软件运维阶段。)
|
||||
|
||||
值得庆幸的是,随着 Kubernetes <ruby>运维器<rt>Operator</rt></ruby>的出现,这种情况正在改变。随着运维器的出现,我们现在有了一个框架,可以将第 2 天的运维知识汇总到平台中。现在,我们可以应用我在 [Kubernetes 基础:首先学习如何使用][4] 中描述的相同的定义状态、实际状态的方法,现在我们可以定义、自动化和维护各种各样的系统管理任务。
|
||||
|
||||
(LCTT 译注: Operator 是 Kubernetes 中的一种可以完成运维工程师的特定工作的组件,业界大多没有翻译这个名词,此处仿运维工程师例首倡翻译为“运维器”。)
|
||||
|
||||
我经常将运维器称为“系统管理机器人”,因为它们实质上是在第 2 天的工作中整理出一堆运维知识,该知识涉及<ruby>主题专家<rt>Subject Matter Expert</rt></ruby>(SME、例如数据库管理员或系统管理员)针对的工作负载类型(数据库、Web 服务器等),通常会记录在 Wiki 中的某个地方。这些知识放在 Wiki 中的问题是,为了将该知识应用于解决问题,我们需要:
|
||||
|
||||
1. 生成事件,通常监控系统会发现故障,然后我们创建故障单
|
||||
2. SME 人员必须对此问题进行调查,即使这是我们之前见过几百万次的问题
|
||||
3. SME 人员必须执行该知识(执行备份/还原、配置 Galera 或事务复制等)
|
||||
|
||||
通过运维器,所有这些 SME 知识都可以嵌入到单独的容器镜像中,该镜像在有实际工作负荷之前就已部署。 我们部署运维器容器,然后运维器部署和管理一个或多个工作负载实例。然后,我们使用“运维器生命周期管理器”(Katacoda 教程)之类的方法来管理运维器。
|
||||
|
||||
因此,随着我们进一步使用 Kubernetes,我们不仅简化了应用程序的部署,而且简化了整个生命周期的管理。运维器还为我们提供了工具,可以管理具有深层配置要求(群集、复制、修复、备份/还原)的非常复杂的有状态应用程序。而且,最好的地方是,构建容器的人员可能是做第 2 天运维的主题专家,因此现在他们可以将这些知识嵌入到操作环境中。
|
||||
|
||||
### 本系列的总结
|
||||
|
||||
Kubernetes 的未来是光明的,就像之前的虚拟化一样,工作负载的扩展是不可避免的。学习如何驾驭 Kubernetes 可能是开发人员或系统管理员可以对自己的职业发展做出的最大投资。随着工作负载的增多,职业机会也将增加。因此,这是驾驶一辆令人惊叹的 [在移动垃圾时非常优雅的翻斗车][2]……
|
||||
|
||||
你可能想在 Twitter 上关注我,我在 [@fatherlinux][6] 上分享有关此主题的很多内容。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/6/kubernetes-potential-run-anything
|
||||
|
||||
作者:[Scott McCarty][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/fatherlinux
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster)
|
||||
[2]: https://opensource.com/article/19/6/kubernetes-dump-truck
|
||||
[3]: https://opensource.com/article/19/6/kubernetes-learning-curve
|
||||
[4]: https://opensource.com/article/19/6/kubernetes-basics
|
||||
[5]: https://opensource.com/article/19/6/tools-drive-kubernetes
|
||||
[6]: https://twitter.com/fatherlinux
|
@ -1,62 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Why containers and Kubernetes have the potential to run almost anything)
|
||||
[#]: via: (https://opensource.com/article/19/6/kubernetes-potential-run-anything)
|
||||
[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux)
|
||||
|
||||
Why containers and Kubernetes have the potential to run almost anything
|
||||
======
|
||||
Go beyond deployment of simple applications and tackle day two
|
||||
operations with Kubernetes Operators.
|
||||
![arrows cycle symbol for failing faster][1]
|
||||
|
||||
In my first article, _[Kubernetes is a dump truck: Here's why][2]_, I talked about about how Kubernetes is elegant at defining, sharing, and running applications, similar to how dump trucks are elegant at moving dirt. In the second, _[How to navigate the Kubernetes learning curve][3]_, I explain that the learning curve for Kubernetes is really the same learning curve for running any applications in production, which is actually easier than learning all of the traditional pieces (load balancers, routers, firewalls, switches, clustering software, clustered files systems, etc). This is DevOps, a collaboration between Developers and Operations to specify the way things should run in production, which means there's a learning curve for both sides. In article four, _[Kubernetes basics: Learn how to drive first][4]_, I reframe learning Kubernetes with a focus on driving the dump truck instead of building or equipping it. In the fourth article, _[4 tools to help you drive Kubernetes][5]_, I share tools that I have fallen in love with to help build applications (drive the dump truck) in Kubernetes.
|
||||
|
||||
In this final article, I share the reasons why I am so excited about the future of running applications on Kubernetes.
|
||||
|
||||
From the beginning, Kubernetes has been able to run web-based workloads (containerized) really well. Workloads like web servers, Java, and associated app servers (PHP, Python, etc) just work. The supporting services like DNS, load balancing, and SSH (replaced by kubectl exec) are handled by the platform. For the majority of my career, these are the workloads I ran in production, so I immediately recognized the power of running production workloads with Kubernetes, aside from DevOps, aside from agile. There is incremental efficiency gain even if we barely change our cultural practices. Commissioning and decommissioning become extremely easy, which were terribly difficult with traditional IT. So, since the early days, Kubernetes has given me all of the basic primitives I need to model a production workload, in a single configuration language (Kube YAML/Json).
|
||||
|
||||
But, what happened if you needed to run Multi-master MySQL with replication? What about redundant data using Galera? How do you do snapshotting and backups? What about sophisticated workloads like SAP? Day zero (deployment) with simple applications (web servers, etc) has been fairly easy with Kubernetes, but day two operations and workloads were not tackled. That's not to say that day two operations with sophisticated workloads were harder than traditional IT to solve, but they weren't made easier with Kubernetes. Every user was left to devise their own genius ideas for solving these problems, which is basically the status quo today. Over the last 5 years, the number one type of question I get is around day two operations of complex workloads.
|
||||
|
||||
Thankfully, that's changing as we speak with the advent of Kubernetes Operators. With the advent of Operators, we now have a framework to codify day two operations knowledge into the platform. We can now apply the same defined state, actual state methodology that I described in [_Kubernetes basics: Learn how to drive first_][4]—we can now define, automate, and maintain a wide range of systems administration tasks.
|
||||
|
||||
I often refer to Operators as "Robot Sysadmins" because they essentially codify a bunch of the day two operations knowledge that a subject matter expert (SME, like database administrator or, systems administrator) for that workload type (database, web server, etc) would normally keep in their notes somewhere in a wiki. The problem with these notes being in a wiki is, for the knowledge to be applied to solve a problem, we need to:
|
||||
|
||||
1. Generate an event, often a monitoring system finds a fault and we create a ticket
|
||||
2. Human SME has to investigate the problem, even if it's something we've seen a million times before
|
||||
3. Human SME has to execute the knowledge (perform the backup/restore, configure the Galera or transaction replication, etc)
|
||||
|
||||
|
||||
|
||||
With Operators, all of this SME knowledge can be embedded in a separate container image which is deployed before the actual workload. We deploy the Operator container, and then the Operator deploys and manages one or more instances of the workload. We then manage the Operators using something like the Operator Lifecycle Manager (Katacoda tutorial).
|
||||
|
||||
So, as we move forward with Kubernetes, we not only simplify the deployment of applications, but also the management over the lifecycle. Operators also give us the tools to manage very complex, stateful applications with deep configuration requirements (clustering, replication, repair, backup/restore. And, the best part is, the people who built the container are probably the subject matter experts for day two operations, so now they can embed that knowledge into the operations environment.
|
||||
|
||||
### The conclusion to this series
|
||||
|
||||
The future of Kubernetes is bright, and like virtualization before it, workload expansion is inevitable. Learning how to drive Kubernetes is probably the biggest investment that a developer or sysadmin can make in their own career growth. As the workloads expand, so will the career opportunities. So, here's to driving an amazing [dump truck that's very elegant at moving dirt][2]...
|
||||
|
||||
If you would like to follow me on Twitter, I share a lot of content on this topic at [@fatherlinux][6]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/6/kubernetes-potential-run-anything
|
||||
|
||||
作者:[Scott McCarty][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/fatherlinux
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster)
|
||||
[2]: https://opensource.com/article/19/6/kubernetes-dump-truck
|
||||
[3]: https://opensource.com/article/19/6/kubernetes-learning-curve
|
||||
[4]: https://opensource.com/article/19/6/kubernetes-basics
|
||||
[5]: https://opensource.com/article/19/6/tools-drive-kubernetes
|
||||
[6]: https://twitter.com/fatherlinux
|
@ -1,148 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to manage music tags using metaflac)
|
||||
[#]: via: (https://opensource.com/article/19/11/metaflac-fix-music-tags)
|
||||
[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen)
|
||||
|
||||
How to manage music tags using metaflac
|
||||
======
|
||||
Correct music tagging errors from the command line with this powerful
|
||||
open source utility.
|
||||
![website design image][1]
|
||||
|
||||
I've been ripping CDs to my computer for a long time now. Over that time, I've used several different tools for ripping, and I have observed that each tool seems to have a different take on tagging, specifically, what metadata to save with the music data. By "observed," I mean that music players seem to sort albums in a funny order, they split tracks in one physical directory into two albums, or they create other sorts of frustrating irritations.
|
||||
|
||||
I've also learned that some of the tags are pretty obscure, and many music players and tag editors don't show them. Even so, they may use them for sorting or displaying music in some edge cases, like where the player separates all the music files containing tag XYZ into a different album from all the files not containing that tag.
|
||||
|
||||
So if the tagging applications and music players don't show the "weirdo" tags—but are somehow affected by them—what can you do?
|
||||
|
||||
### Metaflac to the rescue!
|
||||
|
||||
I have been meaning to get familiar with **[metaflac][2]**, the open source command-line metadata editor for [FLAC files][3], which is my open source music file format of choice. Not that there is anything wrong with great tag-editing software like [EasyTAG][4], but the old saying "if all you have is a hammer…" comes to mind. Also, from a practical perspective, my home and office stereo music needs are met by small, dedicated servers running [Armbian][5] and [MPD][6], with the music files stored locally, running a very stripped-down, music-only headless environment, so a command-line metadata management tool would be quite useful.
|
||||
|
||||
The screenshot below shows the typical problem created by my long-term ripping program: Putumayo's wonderful compilation of Colombian music appears as two separate albums, one containing a single track, the other containing the remaining 11:
|
||||
|
||||
![Album with incorrect tags][7]
|
||||
|
||||
I used metaflac to generate a list of all the tags for all of the FLAC files in the directory containing those tracks:
|
||||
|
||||
|
||||
```
|
||||
rm -f tags.txt
|
||||
for f in *.flac; do
|
||||
echo $f >> tags.txt
|
||||
metaflac --export-tags-to=tags.tmp "$f"
|
||||
cat tags.tmp >> tags.txt
|
||||
rm tags.tmp
|
||||
done
|
||||
```
|
||||
|
||||
I saved this as an executable shell script (see my colleague [David Both][8]'s wonderful series of columns on Bash shell scripting, [particularly the one on loops][9]). Basically, what I'm doing here is creating a file, _tags.txt_, containing the filename (the **echo** command) followed by all its flags, followed by the next filename, and so forth. Here are the first few lines of the result:
|
||||
|
||||
|
||||
```
|
||||
A Guapi.flac
|
||||
TITLE=A Guapi
|
||||
ARTIST=Grupo Bahia
|
||||
ALBUMARTIST=Various Artists
|
||||
ALBUM=Putumayo Presents: Colombia
|
||||
DATE=2001
|
||||
TRACKTOTAL=12
|
||||
GENRE=Latin Salsa
|
||||
MUSICBRAINZ_ALBUMARTISTID=89ad4ac3-39f7-470e-963a-56509c546377
|
||||
MUSICBRAINZ_ALBUMID=6e096386-1655-4781-967d-f4e32defb0a3
|
||||
MUSICBRAINZ_ARTISTID=2993268d-feb6-4759-b497-a3ef76936671
|
||||
DISCID=900a920c
|
||||
ARTISTSORT=Grupo Bahia
|
||||
MUSICBRAINZ_DISCID=RwEPU0UpVVR9iMP_nJexZjc_JCc-
|
||||
COMPILATION=1
|
||||
MUSICBRAINZ_TRACKID=8a067685-8707-48ff-9040-6a4df4d5b0ff
|
||||
ALBUMARTISTSORT=50 de Joselito, Los
|
||||
Cumbia Del Caribe.flac
|
||||
```
|
||||
|
||||
After a bit of investigation, it turns out I ripped a number of my Putumayo CDs at the same time, and whatever software I was using at the time seems to have put the MUSICBRAINZ_ tags on all but one of the files. (A bug? Probably; I see this on a half-dozen albums.) Also, with respect to the sometimes unusual sorting, note the ALBUMARTISTSORT tag moved the Spanish article "Los" to the end of the artist name, after a comma.
|
||||
|
||||
I used a simple **awk** script to list all the tags reported in the _tags.txt_ file:
|
||||
|
||||
|
||||
```
|
||||
`awk -F= 'index($0,"=") > 0 {print $1}' tags.txt | sort -u`
|
||||
```
|
||||
|
||||
This split all lines into fields using **=** as the field separator and prints the first field of lines containing an equals sign. The results are passed through sort with the **-u** flag, which eliminates all duplication in the output (see my colleague Seth Kenlon's great [article on the **sort** utility][10]). For this specific _tags.txt_ file, the output is:
|
||||
|
||||
|
||||
```
|
||||
ALBUM
|
||||
ALBUMARTIST
|
||||
ALBUMARTISTSORT
|
||||
ARTIST
|
||||
ARTISTSORT
|
||||
COMPILATION
|
||||
DATE
|
||||
DISCID
|
||||
GENRE
|
||||
MUSICBRAINZ_ALBUMARTISTID
|
||||
MUSICBRAINZ_ALBUMID
|
||||
MUSICBRAINZ_ARTISTID
|
||||
MUSICBRAINZ_DISCID
|
||||
MUSICBRAINZ_TRACKID
|
||||
TITLE
|
||||
TRACKTOTAL
|
||||
```
|
||||
|
||||
Sleuthing around a bit, I found that the MUSICBRAINZ_ flags appear on all but one FLAC file, so I used the metaflac command to delete those flags:
|
||||
|
||||
|
||||
```
|
||||
for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_ALBUMARTISTID "$f"; done
|
||||
for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_ALBUMID "$f"; done
|
||||
for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_ARTISTID "$f"; done
|
||||
for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_DISCID "$f"; done
|
||||
for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_TRACKID "$f"; done
|
||||
```
|
||||
|
||||
Once that's done, I can rebuild the MPD database with my music player. Here are the results:
|
||||
|
||||
![Album with correct tags][11]
|
||||
|
||||
And, there we are—all 12 tracks together in one album.
|
||||
|
||||
So, yeah, I'm lovin' metaflac a whole bunch. I expect I'll be using it more often as I try to wrangle the last bits of weirdness in my music collection's music tags. It's highly recommended!
|
||||
|
||||
### And the music
|
||||
|
||||
I've been spending a few evenings listening to Odario Williams' program _After Dark_ on CBC Music. (CBC is Canada's public broadcasting corporation.) Thanks to Odario, one of the albums I've really come to enjoy is [_Songs for Cello and Voice_ by Kevin Fox][12]. Here he is, covering the Eurythmics tune "[Sweet Dreams (Are Made of This)][13]."
|
||||
|
||||
I bought this on CD, and now it's on my music server with its tags properly organized!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/11/metaflac-fix-music-tags
|
||||
|
||||
作者:[Chris Hermansen][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/clhermansen
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-design-monitor-website.png?itok=yUK7_qR0 (website design image)
|
||||
[2]: https://xiph.org/flac/documentation_tools_metaflac.html
|
||||
[3]: https://xiph.org/flac/index.html
|
||||
[4]: https://wiki.gnome.org/Apps/EasyTAG
|
||||
[5]: https://www.armbian.com/
|
||||
[6]: https://www.musicpd.org/
|
||||
[7]: https://opensource.com/sites/default/files/uploads/music-tags1_before.png (Album with incorrect tags)
|
||||
[8]: https://opensource.com/users/dboth
|
||||
[9]: https://opensource.com/article/19/10/programming-bash-loops
|
||||
[10]: https://opensource.com/article/19/10/get-sorted-sort
|
||||
[11]: https://opensource.com/sites/default/files/uploads/music-tags2_after.png (Album with correct tags)
|
||||
[12]: https://burlingtonpac.ca/events/kevin-fox/
|
||||
[13]: https://www.youtube.com/watch?v=uyN66XI1zp4
|
@ -0,0 +1,147 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to manage music tags using metaflac)
|
||||
[#]: via: (https://opensource.com/article/19/11/metaflac-fix-music-tags)
|
||||
[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen)
|
||||
|
||||
如何使用 metaflac 管理音乐标签
|
||||
======
|
||||
使用这个强大的开源工具可以在命令行中纠正音乐标签错误。
|
||||
![website design image][1]
|
||||
|
||||
我将 CD 翻录到电脑已经有很长一段时间了。在此期间,我用过几种不同的翻录工具,观察到每种工具在标记上似乎有不同的做法,特别是在保存哪些音乐元数据上。所谓“观察”,是指音乐播放器似乎按照有趣的顺序对专辑进行排序,他们将一个目录中的曲目分为两张专辑,或者产生了其他令人沮丧的烦恼。
|
||||
|
||||
我还看到有些标签非常模糊,许多音乐播放器和标签编辑器没有显示它们。即使这样,在某些极端情况下,它们仍可以使用这些标签来分类或显示音乐,例如播放器将所有包含 XYZ 标签的音乐文件与不包含该标签的所有文件分离到不同的专辑中。
|
||||
|
||||
那么,如果标记应用和音乐播放器没有显示“奇怪”的标记,但是它们受到了某种影响,你该怎么办?
|
||||
|
||||
### Metaflac 来拯救!
|
||||
|
||||
我一直想要熟悉 **[metaflac][2]**,它是一款开源命令行 [FLAC文件][3] 元数据编辑器,这是我选择的开源音乐文件格式。并不是说 [EasyTAG][4] 这样的出色标签编辑软件有什么问题,但我想起“如果你手上有个锤子。。”这句老话(译注:原文是如果你手上有个锤子, 那么所有的东西看起来都像钉子。意指人们惯于用熟悉的方式解决问题,而不管合不合适)。另外,从实际的角度来看,运行 [Armbian][5] 和 [MPD][6]、音乐存储在本地、运行精简、仅限音乐的无头环境的小型专用服务器可以满足我的家庭和办公室立体音乐的需求,因此命令行元数据管理工具将非常有用。
|
||||
|
||||
下面的截图显示了我的长期翻录程序产生的典型问题:Putumayo 的哥伦比亚音乐汇编显示为两张单独的专辑,一张包含单首曲目,另一张包含其余 11 首:
|
||||
|
||||
![Album with incorrect tags][7]
|
||||
|
||||
我使用 metaflac 为目录中包含这些曲目的所有 FLAC 文件生成了所有标签的列表:
|
||||
|
||||
|
||||
```
|
||||
rm -f tags.txt
|
||||
for f in *.flac; do
|
||||
echo $f >> tags.txt
|
||||
metaflac --export-tags-to=tags.tmp "$f"
|
||||
cat tags.tmp >> tags.txt
|
||||
rm tags.tmp
|
||||
done
|
||||
```
|
||||
|
||||
我将其保存为可执行的 shell 脚本(请参阅我的同事 [David Both][8] 关于 Bash shell 脚本的精彩系列专栏文章,[特别是关于循环这章][9])。基本上,我在这做的是创建一个文件 _tags.txt_,包含文件名(**echo** 命令),后面是它的所有标签,然后是下一个文件名,依此类推。 这是结果的前几行:
|
||||
|
||||
|
||||
```
|
||||
A Guapi.flac
|
||||
TITLE=A Guapi
|
||||
ARTIST=Grupo Bahia
|
||||
ALBUMARTIST=Various Artists
|
||||
ALBUM=Putumayo Presents: Colombia
|
||||
DATE=2001
|
||||
TRACKTOTAL=12
|
||||
GENRE=Latin Salsa
|
||||
MUSICBRAINZ_ALBUMARTISTID=89ad4ac3-39f7-470e-963a-56509c546377
|
||||
MUSICBRAINZ_ALBUMID=6e096386-1655-4781-967d-f4e32defb0a3
|
||||
MUSICBRAINZ_ARTISTID=2993268d-feb6-4759-b497-a3ef76936671
|
||||
DISCID=900a920c
|
||||
ARTISTSORT=Grupo Bahia
|
||||
MUSICBRAINZ_DISCID=RwEPU0UpVVR9iMP_nJexZjc_JCc-
|
||||
COMPILATION=1
|
||||
MUSICBRAINZ_TRACKID=8a067685-8707-48ff-9040-6a4df4d5b0ff
|
||||
ALBUMARTISTSORT=50 de Joselito, Los
|
||||
Cumbia Del Caribe.flac
|
||||
```
|
||||
|
||||
经过一番调查,结果发现我同时翻录了很多 Putumayo CD,并且当时我所使用的所有软件似乎给除了一个之外的所有文件加上了 MUSICBRAINZ_ 标签。 (是 bug 么?大概吧。我在六张专辑中都看到了。)此外,关于有时不寻常的排序,注意到,ALBUMARTISTSORT 标签将西班牙语标题 “Los” 移到了标题的最后面(逗号之后)。
|
||||
|
||||
我使用了一个简单的 **awk** 脚本来列出 _tags.txt_ 中报告的所有标签:
|
||||
|
||||
|
||||
```
|
||||
`awk -F= 'index($0,"=") > 0 {print $1}' tags.txt | sort -u`
|
||||
```
|
||||
|
||||
这会使用 **=** 作为字段分隔符将所有行拆分为字段,并打印包含等号的行的第一个字段。结果通过使用 sort 带上 **-u** 标志来传递,从而消除了输出中的所有重复项(请参阅我的同事 Seth Kenlon 的[关于 **sort** 程序的文章][10])。对于这个 _tags.txt_ 文件,输出为:
|
||||
|
||||
|
||||
```
|
||||
ALBUM
|
||||
ALBUMARTIST
|
||||
ALBUMARTISTSORT
|
||||
ARTIST
|
||||
ARTISTSORT
|
||||
COMPILATION
|
||||
DATE
|
||||
DISCID
|
||||
GENRE
|
||||
MUSICBRAINZ_ALBUMARTISTID
|
||||
MUSICBRAINZ_ALBUMID
|
||||
MUSICBRAINZ_ARTISTID
|
||||
MUSICBRAINZ_DISCID
|
||||
MUSICBRAINZ_TRACKID
|
||||
TITLE
|
||||
TRACKTOTAL
|
||||
```
|
||||
|
||||
研究一会后,我发现 MUSICBRAINZ_ 标签出现在除了一个 FLAC 文件之外的所有文件上,因此我使用 metaflac 命令删除了这些标签:
|
||||
|
||||
|
||||
```
|
||||
for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_ALBUMARTISTID "$f"; done
|
||||
for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_ALBUMID "$f"; done
|
||||
for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_ARTISTID "$f"; done
|
||||
for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_DISCID "$f"; done
|
||||
for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_TRACKID "$f"; done
|
||||
```
|
||||
|
||||
完成后,我可以使用音乐播放器重建 MPD 数据库。结果如下:
|
||||
|
||||
![Album with correct tags][11]
|
||||
|
||||
完成了,12 首曲目出现在了一张专辑中。
|
||||
|
||||
太好了,我很喜欢 metaflac。我希望我会更频繁地使用它,因为我会试图去纠正最后一些我弄乱的音乐收藏标签。强烈推荐!
|
||||
|
||||
### 关于音乐
|
||||
|
||||
我花了几个晚上在 CBC 音乐(CBC 是加拿大的公共广播公司)上收听 Odario Williams 的节目 _After Dark_。感谢 Odario,我听到了让我非常享受的 [Kevin Fox 的 _Songs for Cello and Voice_] [12]。在这里,他演唱了 Eurythmics 的歌曲 “[Sweet Dreams(Are Made of This)][13]”。
|
||||
|
||||
我购买了这张 CD,现在它在我的音乐服务器上,还有组织正确的标签!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/11/metaflac-fix-music-tags
|
||||
|
||||
作者:[Chris Hermansen][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/clhermansen
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-design-monitor-website.png?itok=yUK7_qR0 (website design image)
|
||||
[2]: https://xiph.org/flac/documentation_tools_metaflac.html
|
||||
[3]: https://xiph.org/flac/index.html
|
||||
[4]: https://wiki.gnome.org/Apps/EasyTAG
|
||||
[5]: https://www.armbian.com/
|
||||
[6]: https://www.musicpd.org/
|
||||
[7]: https://opensource.com/sites/default/files/uploads/music-tags1_before.png (Album with incorrect tags)
|
||||
[8]: https://opensource.com/users/dboth
|
||||
[9]: https://opensource.com/article/19/10/programming-bash-loops
|
||||
[10]: https://opensource.com/article/19/10/get-sorted-sort
|
||||
[11]: https://opensource.com/sites/default/files/uploads/music-tags2_after.png (Album with correct tags)
|
||||
[12]: https://burlingtonpac.ca/events/kevin-fox/
|
||||
[13]: https://www.youtube.com/watch?v=uyN66XI1zp4
|
Loading…
Reference in New Issue
Block a user