Trying to Read Tags from mp3's (1 Viewer)

jimbruskalski

Portal Member
April 28, 2006
8
0
Hi, I am not really sure which classes are meant to read from music files, but I am trying to write a simple plugin that will display the file's tag information. It is more for me to learn how to use everything than for its functionality. However, I have tried many different combinations and am unable to get it to read any tags or say that it supports the file I give it. I know the mp3's have filled tag information. Thanks.
 

samuel337

Portal Pro
August 25, 2004
772
0
Melbourne, Australia
Here you go:
Code:
tag = TagReader.TagReader.ReadTag(strPathSong);

where strPathSong is the path to the music file, and tag is the musictag object that's returned by the function containing all the tag information.

Sam
 

jimbruskalski

Portal Member
April 28, 2006
8
0
This is what I have and it is not working:

"protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
{
if (control == buttonOne)
{
MusicTag tag = TagReader.ReadTag("M\\:\\Document and Settings\\Andrew\\My Documents\\final music final\\Adore\\03 Perfect.mp3");

string str = "didn't work, sorry...";
str = tag.Album;

GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
dlg.SetHeading("Button has been pressed");
dlg.SetLine(1, str);
dlg.SetLine(2, String.Empty);
dlg.SetLine(3, String.Empty);
dlg.DoModal(GUIWindowManager.ActiveWindow);
}
lblOne.Label = "You changed the text!";
lblOne.UpdateLayout();
base.OnClicked(controlId, control, actionType);
}"


The dialog box does not come up with this; however, if I take this line out (" MusicTag tag = TagReader.ReadTag("M\\:\\Document and Settings\\Andrew\\My Documents\\final music final\\Adore\\03 Perfect.mp3");") it does show the dialog box. Why is this? What am I doing wrong? Thank you so much.
 

jimbruskalski

Portal Member
April 28, 2006
8
0
I am sorry, there was a mistake in my previous post. If I leave that line in there (the one I said wouldnt work; the creation of the music tag) it still works. It is only when I assign the variable str to tag.Artist or any member of tag that it doesnt work. It is like it is not reading the file. The string location I pass it is correct and I know for a fact the mp3 has tags with information in them.
 

jimbruskalski

Portal Member
April 28, 2006
8
0
Hi, I figured out my problem. I was using "M\\:\\..." instead of "M:\\". I originally had it write, but when that didnt work, I tried the first thinking that might be the problem. When you gave me the solution, I didnt change it back to the original and so it still didnt work. Now that I have used your solution and changed the location string back the original, it works. Thanks so much for your help!
 

Users who are viewing this thread

Top Bottom