用VB.NET + WinForms检查音乐文件的评级 [英] Check music file rating with VB.NET + WinForms

查看:115
本文介绍了用VB.NET + WinForms检查音乐文件的评级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个编辑MP3标签的应用程序,例如标题,专辑等等。

但是我想编辑文件等级,与文件的URL,就像当你使用Windows属性对话框或Windows资源管理器。



但是,我已经在网上搜索,在StackOverflow ,但我什么也没找到。



Cumps,

Scorch

解决方案在taglib-Sharp中有一个名为流行的框架。您将需要使用它来编辑评分。



这是一个简单的代码,说明如何将特定的mp3的评级设置为5星。

 Dim tag As TagLib.Tag = Fi.GetTag(TagLib.TagTypes.Id3v2 )

Dim PopM As TagLib.Id3v2.PopularimeterFrame = TagLib.Id3v2.PopularimeterFrame.Get(tag,WindowsUser,True)


PopM.Rating = 255

Fi.Save()
Fi.Dispose()



<评分是一个字节,所以你需要去这样的事情来得到你的星相当于计算:
$ b


unrated = 0 ,1 = 1-63,2 = 64-127,3 = 128-191,4 = 192-254,5 = 255

正如你所提到的,并不是所有的东西都能读取标签中的评分,例如我相信iTunes使用元数据。但它不是一个窗口的具体功能。

本文档可能有用,即使它已经过时了。


I'm developing an application for editing the MP3 tags, such as title, album, etc...

But I wanted to make possible to edit the file rating, with the file URL, just like it is when you use the windows properties dialog or the windows explorer.

However, I have looked in the web, searched in StackOverflow, but I have found nothing.

Cumps,
Scorch

解决方案

In taglib-Sharp there is a class called PopularmeterFrame. You will need to use that to edit ratings.

This is simple code illustrating how to set the rating of a specific mp3 to 5 stars.

        Dim Fi As TagLib.File = TagLib.File.Create("E:\SomeSong.mp3")
        Dim tag As TagLib.Tag = Fi.GetTag(TagLib.TagTypes.Id3v2)

        Dim PopM As TagLib.Id3v2.PopularimeterFrame = TagLib.Id3v2.PopularimeterFrame.Get(tag, "WindowsUser", True)


        PopM.Rating = 255

        Fi.Save()
        Fi.Dispose()

The rating is is a byte so you will need to go with something like this to get your star equivalent calculated:

unrated=0, 1=1-63, 2=64-127, 3=128-191, 4=192-254, 5=255

As you mentioned not everything reads the ratings in tags, for example I believe iTunes uses metadata instead. But it is not a windows specific feature.

This Documentation may be useful even though it is somewhat out of date.

这篇关于用VB.NET + WinForms检查音乐文件的评级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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