aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiederick de Vries <diederick@diederickdevries.net>2018-11-19 11:04:30 +0100
committerDiederick de Vries <diederick@diederickdevries.net>2018-11-19 11:04:30 +0100
commit1da3a53baab4c336ba386c546c147ac3b6843e44 (patch)
treee719d597945417821f25c9f8aecd371f3fe2f8a2
parentfd6ff03af28017c8f21455abac882fa8581b7409 (diff)
downloadaftercare-1da3a53baab4c336ba386c546c147ac3b6843e44.tar.gz
aftercare-1da3a53baab4c336ba386c546c147ac3b6843e44.tar.bz2
aftercare-1da3a53baab4c336ba386c546c147ac3b6843e44.zip
fix: consider episodes number in 01x01 format when guessing series number
-rw-r--r--aftercare.groovy6
1 files changed, 5 insertions, 1 deletions
diff --git a/aftercare.groovy b/aftercare.groovy
index 44da5de..af8870e 100644
--- a/aftercare.groovy
+++ b/aftercare.groovy
@@ -95,7 +95,7 @@ class Aftercare {
95 [ 95 [
96 original: file.getCanonicalPath(), 96 original: file.getCanonicalPath(),
97 series: findEpisodeName(file.name, se), 97 series: findEpisodeName(file.name, se),
98 season: se.substring(1,3) as Integer, 98 season: findEpisodeNumber(se) as Integer,
99 episode: se.toUpperCase(), 99 episode: se.toUpperCase(),
100 ext: file.name.substring(file.name.lastIndexOf('.') + 1), 100 ext: file.name.substring(file.name.lastIndexOf('.') + 1),
101 path: file.getCanonicalPath().substring (0, file.getCanonicalPath().lastIndexOf('/')) 101 path: file.getCanonicalPath().substring (0, file.getCanonicalPath().lastIndexOf('/'))
@@ -150,6 +150,10 @@ class Aftercare {
150 return t.trim() 150 return t.trim()
151 } 151 }
152 152
153 private String findEpisodeNumber(String s) {
154 return s.toLowerCase().startsWith('s') ? s.substring(1,3) : s.substring(0,2)
155 }
156
153 private String findEpisodeName(String s, String se) { 157 private String findEpisodeName(String s, String se) {
154 this.capitalize(s.substring(0, s.indexOf(se)) 158 this.capitalize(s.substring(0, s.indexOf(se))
155 .replaceAll("\\.", "\\ ") 159 .replaceAll("\\.", "\\ ")