diff --git a/projects/robodj/src/java/robodj/convert/CDParanoiaRipper.java b/projects/robodj/src/java/robodj/convert/CDParanoiaRipper.java index 170d39e0..64d5a0da 100644 --- a/projects/robodj/src/java/robodj/convert/CDParanoiaRipper.java +++ b/projects/robodj/src/java/robodj/convert/CDParanoiaRipper.java @@ -1,5 +1,5 @@ // -// $Id: CDParanoiaRipper.java,v 1.7 2003/10/10 21:25:46 mdb Exp $ +// $Id: CDParanoiaRipper.java,v 1.8 2003/10/10 21:30:42 mdb Exp $ package robodj.convert; @@ -24,7 +24,8 @@ public class CDParanoiaRipper implements Ripper // 1. 17980 [03:59.55] 0 [00:00.00] no no 2 Pattern regex; try { - regex = Pattern.compile("^\\s*\\d+\\.\\s+(\\d+)\\s\\[\\S*\\]\\s+(\\d+)"); + regex = Pattern.compile( + "^\\s*\\d+\\.\\s+(\\d+)\\s\\[\\S*\\]\\s+(\\d+)"); } catch (PatternSyntaxException pse) { throw new ConvertException("Can't compile regexp?! " + pse); } @@ -56,7 +57,7 @@ public class CDParanoiaRipper implements Ripper input.append(inline).append("\n"); // see if we match our regular expression - Matcher match = regex.match(inline); + Matcher match = regex.matcher(inline); if (match.matches()) { flist.add(inline.substring(match.start(0), match.end(0))); flist.add(inline.substring(match.start(1), match.end(1))); @@ -150,15 +151,15 @@ public class CDParanoiaRipper implements Ripper } // parse the output - Matcher match = regex.match(out); + Matcher match = regex.matcher(out); if (match.matches()) { String action = out.substring(match.start(0), match.end(0)); long offset = -1L; try { - String ostr = out.substring(match.start(1), match.end(1)); - offset = Long.parseLong(ostr); + offset = Long.parseLong( + out.substring(match.start(1), match.end(1))); } catch (NumberFormatException nfe) { - // System.err.println("Malformed position info: " + out); + // System.err.println("Malformed pos. info: " + out); continue; } diff --git a/projects/robodj/src/java/robodj/convert/LameEncoder.java b/projects/robodj/src/java/robodj/convert/LameEncoder.java index 22ce8434..937858ea 100644 --- a/projects/robodj/src/java/robodj/convert/LameEncoder.java +++ b/projects/robodj/src/java/robodj/convert/LameEncoder.java @@ -1,12 +1,14 @@ // -// $Id: LameEncoder.java,v 1.2 2003/10/10 19:33:16 mdb Exp $ +// $Id: LameEncoder.java,v 1.3 2003/10/10 21:30:42 mdb Exp $ package robodj.convert; import java.io.*; import java.util.ArrayList; -import gnu.regexp.*; +import java.util.regex.Pattern; +import java.util.regex.Matcher; +import java.util.regex.PatternSyntaxException; /** * An encoder implementation that uses LAME to do it's job. @@ -24,13 +26,13 @@ public class LameEncoder implements Encoder cmd.append(" ").append(dest); // add output file name // we'll need this for later - RE regex; + Pattern regex; try { // a line of input looks like this // 0/1273 ( 0%)| 0:00/ 0:00... - regex = new RE("^\\s*(\\d+)/(\\d+)\\s*\\(.*"); - } catch (REException ree) { - throw new ConvertException("Can't compile regexp?! " + ree); + regex = Pattern.compile("^\\s*(\\d+)/(\\d+)\\s*\\(.*"); + } catch (PatternSyntaxException pse) { + throw new ConvertException("Can't compile regexp?! " + pse); } try { @@ -53,12 +55,14 @@ public class LameEncoder implements Encoder } // parse the output - REMatch match = regex.getMatch(out); - if (match != null) { + Matcher match = regex.matcher(out); + if (match.matches()) { int offset = -1, total = -1; try { - offset = Integer.parseInt(match.toString(1)); - total = Integer.parseInt(match.toString(2)); + offset = Integer.parseInt( + out.substring(match.start(0), match.end(0))); + total = Integer.parseInt( + out.substring(match.start(1), match.end(1))); } catch (NumberFormatException nfe) { System.err.println("Malformed position info: " + out); continue;