如何获得在C#中的* .MP3文件的属性 [英] How to get the Properties of a *.mp3 File in C#

查看:140
本文介绍了如何获得在C#中的* .MP3文件的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I'm有歌库编程一点点的媒体播放器。 现在,我需要一个MP3,WMA文件的属性,如歌手名或歌曲的持续时间。

I´m programming a little media player with a song library. Now I need to get the properties of a mp3,wma file, like the artist name or the song duration.

什么是获得此类信息的最佳方式是什么?

What is the best way to get this information?

推荐答案

您可以检查的MP3的 ID3 标记。该标签库锋利库是非常适合这样做。可用的源$ C ​​$ C(这里)。例如:code:

You can examine the ID3 tag of the mp3s. The taglib-sharp library is great for doing so. Source code available (here). Example code:

TagLib.File tagFile = TagLib.File.Create(pathtofile);
string artist = tagFile.Tag.FirstAlbumArtist;
string album = tagFile.Tag.Album;
string title = tagFile.Tag.Title;
...

不知道标签的lib支持.WMA虽然...标签LIB然而,可以移植到Silverlight的(如果需要的话)。

Not sure if tag-lib supports .wma though... Tag-lib can however be ported to silverlight (if needed).

这篇关于如何获得在C#中的* .MP3文件的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆