2012-05-29, 16:40
(2012-05-28, 23:31)barney_1 Wrote: but I was wondering if anyone has any ideas on how I can sort this out programmatically?
I used a dirty little hack to take care of this. I suppose it could be abstracted and mapped to the xml file to rewrite episode numbers but I'm not sure there's any use in that. Diff file attached for anyone interested (this should not be added to the repo).
Code:
Index: Archiver.java
===================================================================
--- Archiver.java (revision 8)
+++ Archiver.java (working copy)
@@ -748,7 +748,21 @@
Matcher m = p.matcher(video.getFileLabel());
if(m.find())
{
- String match = m.group();
+ String match = m.group();
+
+ //Jimmy Fallon episode number hack
+ if (video.getFileLabel().startsWith("Late Night with Jimmy Fallon"))
+ {
+ log(DEBUG, "This is a Jimmy Fallon Episode: Trying to sort out episode numbers");
+ log(DEBUG, "m.group() = " + m.group());
+ String[] oldEpNum = m.group().split("x");
+ Integer epNum = Integer.parseInt(oldEpNum[1]);
+ if (epNum < 562) return match; //Probably a correct ep num... abort!
+ String fixedEpInfo = "2012x" + String.valueOf(epNum-561);
+ log(DEBUG, "New match value: " + fixedEpInfo);
+ return fixedEpInfo;
+ }
+
return match;
}