* updated episode/movie detection (esp. for {n} {e} pattern)
This commit is contained in:
parent
e64d97b222
commit
a15ee1dd98
|
@ -163,6 +163,11 @@ def getRenameLog(complete = false) {
|
|||
import net.sourceforge.filebot.media.*
|
||||
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 input = path instanceof File ? path.name : path.toString()
|
||||
def sxe = MediaDetection.parseEpisodeNumber(input, strict)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
^new$
|
||||
^other$
|
||||
^Season.[0-9]+
|
||||
^storage$
|
||||
^Torrents[s]?
|
||||
^Tracker
|
||||
^Trailer
|
||||
|
|
|
@ -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)
|
||||
}
|
|
@ -19,17 +19,16 @@ def groups = input.groupBy{ f ->
|
|||
|
||||
// DECIDE EPISODE VS MOVIE (IF NOT CLEAR)
|
||||
if (tvs && mov) {
|
||||
def fn = f.nameWithoutExtension.space(' ')
|
||||
if (fn =~ "(?i:$tvs - .+)" || parseEpisodeNumber(fn, true) || parseDate(fn)) {
|
||||
def norm = { s -> s.lower().space(' ') }
|
||||
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"
|
||||
mov = null
|
||||
} else if (detectMovie(f, true) && (fn =~ /(19|20)\d{2}/ || !(tvs =~ "(?i:$mov.name)"))) {
|
||||
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)) {
|
||||
} 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
|
||||
}
|
||||
|
|
|
@ -40,17 +40,16 @@ def groups = input.groupBy{ f ->
|
|||
|
||||
// DECIDE EPISODE VS MOVIE (IF NOT CLEAR)
|
||||
if (tvs && mov) {
|
||||
def fn = f.nameWithoutExtension.space(' ')
|
||||
if (fn =~ "(?i:$tvs - .+)" || parseEpisodeNumber(fn, true) || parseDate(fn)) {
|
||||
def norm = { s -> s.lower().space(' ') }
|
||||
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"
|
||||
mov = null
|
||||
} else if (detectMovie(f, true) && (fn =~ /(19|20)\d{2}/ || !(tvs =~ "(?i:$mov.name)"))) {
|
||||
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)) {
|
||||
} 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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue