1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-13 04:45:01 -05:00
filebot/source/net/filebot/web/AudioTrackFormat.java
2014-04-19 06:30:29 +00:00

31 lines
595 B
Java

package net.filebot.web;
import java.text.FieldPosition;
import java.text.Format;
import java.text.ParsePosition;
public class AudioTrackFormat extends Format {
@Override
public StringBuffer format(Object obj, StringBuffer sb, FieldPosition pos) {
return sb.append(obj.toString());
}
@Override
public AudioTrack parseObject(String source, ParsePosition pos) {
String[] s = source.split(" - ", 2);
if (s.length == 2) {
pos.setIndex(source.length());
return new AudioTrack(s[0].trim(), s[1].trim(), "VA");
} else {
pos.setErrorIndex(0);
return null;
}
}
}