Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRCK Parsing #29

Open
spottedmahn opened this issue Dec 17, 2019 · 0 comments
Open

TRCK Parsing #29

spottedmahn opened this issue Dec 17, 2019 · 0 comments

Comments

@spottedmahn
Copy link

I have some songs, from Amazon.com, that have a frame value of new byte[] { 0, 50, 47, 49, 53, 0 } for the TRCK frame and this library isn't recognizing the values.

foobar2000 doesn't have any issues parsing it though.

I've removed the beginning, ^, and end of line, $, anchors and now it parses the values.

[Fact]
public void TRCK_BugTest()
{
	//arrange
	var path = $@"{dirStart}\01-02- DNA [Explicit] - Copy.mp3";
	var mp3 = new Mp3(path, Mp3Permissions.ReadWrite);
	var tag = mp3.GetTag(Id3TagFamily.Version2X);
	//works after changing regex
	//removing start and end things
	//data that doesn't currently work:
	//var data = new byte[] { 0, 50, 47, 49, 53, 0 };
	//was
	//Regex TrackPattern = new Regex(@"^(\d+)(?:/(\d+))?$");
	//now
	//Regex TrackPattern = new Regex(@"(\d+)(?:/(\d+))?");
	Assert.Equal(2, tag.Track.Value);
	Assert.Equal(15, tag.Track.TrackCount);

	//act 
	//should throw an exception that data will be lost
	var newMp3 = new Mp3(path + " - trck test.mp3", Mp3Permissions.ReadWrite);
	newMp3.WriteTag(tag);
	newMp3.Dispose();

	//assert
	var newMp3Assert = new Mp3(path + " - trck test.mp3", Mp3Permissions.Read);
	var tagAssert = newMp3Assert.GetTag(Id3TagFamily.Version2X);
	Assert.Equal(tag.Track.TrackCount, tagAssert.Track.TrackCount);
	Assert.Equal(tag.Track.Value, tagAssert.Track.Value);
}

Thoughts? 💭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant