-
Notifications
You must be signed in to change notification settings - Fork 309
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
added TXXX based tags support #122
base: master
Are you sure you want to change the base?
Conversation
Hi @Code0987 , thanks for your PR. Could you please make this patch compile on travis-ci? There is an import used that is not available in the project. |
Related to #55 |
Import fixed. I'll write tests asap. Currently I'm not familiar with java tests much. |
Let me know if you have any questions regarding java / JUnit testing, @Code0987 |
@hennr I've added test and updated code also. But I'm not sure if it's right! |
Hi @Code0987 , yep, there are some things that should be changed. Add me as a collaborator to your forked project and we can work together on them. |
pom.xml
Outdated
@@ -46,6 +46,12 @@ | |||
<version>4.12</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this dependency is never used
import org.junit.Test; | ||
import static org.junit.Assert.*; | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This info is already held in the git history, please remove
*/ | ||
public class ID3v2TXXXFrameDataTest { | ||
|
||
public ID3v2TXXXFrameDataTest() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unneeded
public ID3v2TXXXFrameDataTest() { | ||
} | ||
|
||
@BeforeClass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementing these annotations are optional. Simply delete all of the if empty.
public void tearDown() { | ||
} | ||
|
||
@org.junit.Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@test without the complete path should work.
|
||
@org.junit.Test | ||
public void test() throws Exception { | ||
System.out.println("test for txxx frame"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the system.out
} | ||
|
||
@org.junit.Test | ||
public void test() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please describe what the test ensures and rename test() according.
"my_custom_text", | ||
"value", | ||
true); | ||
assertEquals(1, frameSets.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a best practice to have one assertion per @test annotated method.
The method-/test name should describe what it ensures.
@Code0987 I merged the upstream master into your fork and added some comments in the test. |
I followed your comments and have updated tests, let me know anything else to do. |
Thanks @Code0987 |
@hennr No, I was just trying to keep all related code together, as it was a little different for custom tags then all other tags already implemented. I was using your work in a android project using gradle dependency, so I just copied this TXXX extra file, since I wanted not to overwrite over your code, that would break auto-updating and maybe license too. |
OK, so we can change that to instance methods now? |
Another question:
This does not work for me at the moment. |
Ok, I'll see and update. |
@hennr |
bug fix
protected void unpackFrameData(byte[] bytes) throws InvalidDataException { | ||
int marker = BufferTools.indexOfTerminatorForEncoding(bytes, 1, bytes[0]); | ||
|
||
description = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, 1, marker - 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the description has zero length, the marker position could be 0, in which case the copyBuffer
will fail. I suggest adding something like what is done in ID3v2UrlFrameData
, which checks if marker >= 0 before doing the copy, otherwise sets the description to an empty string.
|
||
marker += description.getTerminator().length; | ||
|
||
value = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, marker, bytes.length - marker)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, check if bytes.length - marker >= 0
if (getClass() != obj.getClass()) { | ||
return false; | ||
} | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why the equals
method is not fully implemented? It's returning false for separate object instances that contain the same description and value, but it should return true. Your IDE should be able to generate it for you.
To be consistent with how the code is currently structured, the static methods on |
* upstream/master: introduce changelog.md and prefer id3v2 over id3v1 for genre and genre description; closes mpatric#120 (mpatric#124)
Hi Its really too bad that you still did not approved this pull request. Is there anything I can do to help in this matter ? |
Added a new class for TXXX style tags which have description and value as
ID3 Specs