Added support for links in vorbis comment

This commit is contained in:
daniel oeh 2012-11-09 19:40:10 +01:00
parent 8cf119ce7f
commit 1210c7a8a4
1 changed files with 9 additions and 6 deletions

View File

@ -43,12 +43,13 @@ public class VorbisCommentChapterReader extends VorbisCommentReader {
if (AppConfig.DEBUG)
Log.d(TAG, "Key: " + key + ", value: " + value);
String attribute = VorbisCommentChapter.getAttributeTypeFromKey(key);
if (attribute == null) {
int id = VorbisCommentChapter.getIDFromKey(key);
Chapter chapter = getChapterById(id);
if (attribute == null) {
if (getChapterById(id) == null) {
// new chapter
long start = VorbisCommentChapter.getStartTimeFromValue(value);
VorbisCommentChapter chapter = new VorbisCommentChapter(id);
chapter = new VorbisCommentChapter(id);
chapter.setStart(start);
chapters.add(chapter);
} else {
@ -57,10 +58,12 @@ public class VorbisCommentChapterReader extends VorbisCommentReader {
+ value + ")");
}
} else if (attribute.equals(CHAPTER_ATTRIBUTE_TITLE)) {
int id = VorbisCommentChapter.getIDFromKey(key);
Chapter c = getChapterById(id);
if (c != null) {
c.setTitle(value);
if (chapter != null) {
chapter.setTitle(value);
}
} else if (attribute.equals(CHAPTER_ATTRIBUTE_LINK)) {
if (chapter != null) {
chapter.setLink(value);
}
}
}