* updated episode/movie detection (esp. for {n} {e} pattern)

This commit is contained in:
Reinhard Pointner 2012-07-21 14:32:55 +00:00
parent e64d97b222
commit a15ee1dd98
5 changed files with 22 additions and 30 deletions

View File

@ -163,6 +163,11 @@ def getRenameLog(complete = false) {
import net.sourceforge.filebot.media.* import net.sourceforge.filebot.media.*
import net.sourceforge.filebot.similarity.* import net.sourceforge.filebot.similarity.*
def isEpisode(path, strict = true) {
def input = path instanceof File ? path.name : path.toString()
return MediaDetection.isEpisode(input, strict)
}
def parseEpisodeNumber(path, strict = true) { def parseEpisodeNumber(path, strict = true) {
def input = path instanceof File ? path.name : path.toString() def input = path instanceof File ? path.name : path.toString()
def sxe = MediaDetection.parseEpisodeNumber(input, strict) def sxe = MediaDetection.parseEpisodeNumber(input, strict)

View File

@ -24,6 +24,7 @@
^new$ ^new$
^other$ ^other$
^Season.[0-9]+ ^Season.[0-9]+
^storage$
^Torrents[s]? ^Torrents[s]?
^Tracker ^Tracker
^Trailer ^Trailer

View File

@ -1,12 +0,0 @@
def dir = 'E:/Downloads'
// extract files from archives and delete archives afterwards
extract(folder:dir, output:dir) && dir.listFiles{ it =~ /rar$/ }*.delete()
getMissingSubtitles(folder:dir, lang:'de', strict:false)
getMissingSubtitles(folder:dir, lang:'en', strict:false)
// rename each file individually in strict mode
dir.listFiles().each {
rename(file:it, format:"E:/Series/{n}/{n.space('.')}.{s00e00}.{t.space('.')}", strict:true)
}

View File

@ -19,17 +19,16 @@ def groups = input.groupBy{ f ->
// DECIDE EPISODE VS MOVIE (IF NOT CLEAR) // DECIDE EPISODE VS MOVIE (IF NOT CLEAR)
if (tvs && mov) { if (tvs && mov) {
def fn = f.nameWithoutExtension.space(' ') def norm = { s -> s.lower().space(' ') }
if (fn =~ "(?i:$tvs - .+)" || parseEpisodeNumber(fn, true) || parseDate(fn)) { def fn = norm(f.nameWithoutExtension)
def sn = norm(tvs)
def mn = norm(mov.name)
// S00E00 | 2012.07.21 | One Piece 217 | Firefly - Serenity | [Taken 1, Taken 2, Taken 3, Taken 4, ..., Taken 10]
if (parseEpisodeNumber(fn, true) || parseDate(fn) || (fn =~ sn && parseEpisodeNumber(fn.after(sn), false)) || fn.after(sn) =~ / - .+/ || f.dir.listFiles{ it.isVideo() && norm(it.name) =~ sn && it.name =~ /\b\d{1,3}\b/}.size() >= 10) {
println "Exclude Movie: $mov" println "Exclude Movie: $mov"
mov = null mov = null
} else if (detectMovie(f, true) && (fn =~ /(19|20)\d{2}/ || !(tvs =~ "(?i:$mov.name)"))) { } else if ((detectMovie(f, true) && fn =~ /(19|20)\d{2}/) || (fn =~ mn && !(fn.after(mn) =~ /\b\d{1,3}\b/))) {
println "Exclude Series: $tvs"
tvs = null
} else if (fn =~ "(?i:$tvs)" && parseEpisodeNumber(fn.after(tvs), false)) {
println "Exclude Movie: $mov"
mov = null
} else if (fn =~ "(?i:$mov.name)" && !parseEpisodeNumber(fn.after(mov.name), false)) {
println "Exclude Series: $tvs" println "Exclude Series: $tvs"
tvs = null tvs = null
} }

View File

@ -40,17 +40,16 @@ def groups = input.groupBy{ f ->
// DECIDE EPISODE VS MOVIE (IF NOT CLEAR) // DECIDE EPISODE VS MOVIE (IF NOT CLEAR)
if (tvs && mov) { if (tvs && mov) {
def fn = f.nameWithoutExtension.space(' ') def norm = { s -> s.lower().space(' ') }
if (fn =~ "(?i:$tvs - .+)" || parseEpisodeNumber(fn, true) || parseDate(fn)) { def fn = norm(f.nameWithoutExtension)
def sn = norm(tvs)
def mn = norm(mov.name)
// S00E00 | 2012.07.21 | One Piece 217 | Firefly - Serenity | [Taken 1, Taken 2, Taken 3, Taken 4, ..., Taken 10]
if (parseEpisodeNumber(fn, true) || parseDate(fn) || (fn =~ sn && parseEpisodeNumber(fn.after(sn), false)) || fn.after(sn) =~ / - .+/ || f.dir.listFiles{ it.isVideo() && norm(it.name) =~ sn && it.name =~ /\b\d{1,3}\b/}.size() >= 10) {
println "Exclude Movie: $mov" println "Exclude Movie: $mov"
mov = null mov = null
} else if (detectMovie(f, true) && (fn =~ /(19|20)\d{2}/ || !(tvs =~ "(?i:$mov.name)"))) { } else if ((detectMovie(f, true) && fn =~ /(19|20)\d{2}/) || (fn =~ mn && !(fn.after(mn) =~ /\b\d{1,3}\b/))) {
println "Exclude Series: $tvs"
tvs = null
} else if (fn =~ "(?i:$tvs)" && parseEpisodeNumber(fn.after(tvs), false)) {
println "Exclude Movie: $mov"
mov = null
} else if (fn =~ "(?i:$mov.name)" && !parseEpisodeNumber(fn.after(mov.name), false)) {
println "Exclude Series: $tvs" println "Exclude Series: $tvs"
tvs = null tvs = null
} }