First, thanks for a great program. Donated a bit to the purchase of the website, and I hope it comes together for you
I have a small problem with my groovy script. Have stolen a bit from the sortivo and the sorty scripts.
My problem is that although I have defined the episodeDir, it always puts in in episodeDir/TV Shows/{show}/Season xx/episodeFormat
How can I get rid of the "TV Shows/{show}/Season xx/" bit?
It is probably something really simple, and comes down to my lack of understanding...
Help is much appreciated!
edit: Here is the output:
Code: Select all
Input: /home/henrik/filebotexp/Mr Selfridge - 01x08 - Episode 8.mp4
Mr Selfridge - 01x08 - Episode 8.mp4 [series: Mr Selfridge, movie: null]
Rename episodes using [TheTVDB]
Auto-detected query: [Mr Selfridge]
Fetching episode data for [Mr Selfridge]
[MOVE] Rename [/home/henrik/filebotexp/Mr Selfridge - 01x08 - Episode 8.mp4] to [TV Shows/Mr Selfridge/Season 1/Mr Selfridge - S01E08 - Episode 8.mp4]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ
Failed to write xattr: java.io.File.toPath()Ljava/nio/file/Path;
Code: Select all
// filebot -script fn:sortivo <folder> --output path/to/folder [-non-strict]
def episodeDir = '''~/filebotexp/comp'''
def episodeFormat = '''~/filebotexp/comp/{episode}'''
// process only media files
def input = args.getFiles{ it.isVideo() || it.isSubtitle() }
// ignore clutter files
input = input.findAll{ !(it.path =~ /\b(?i:sample|trailer|extras|deleted.scenes|music.video|scrapbook)\b/) }
// print input fileset
input.each{ println "Input: $it" }
/*
* Move/Rename a mix of episodes and movies that are all in the same folder.
*/
def groups = input.groupBy{ f ->
def tvs = detectSeriesName(f)
def mov = (parseEpisodeNumber(f) || parseDate(f)) ? null : detectMovie(f, false) // skip movie detection if we can already tell it's an episode
// DECIDE EPISODE VS MOVIE (IF NOT CLEAR)
if (tvs && mov) {
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{ $
println "Exclude Movie: $mov"
mov = null
} 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
}
}
return [tvs:tvs, mov:mov]
groups.each{ group, files ->
// EPISODE MODE
if (group.tvs && !group.mov) {
// rename(file:files, format:'{n} - {episode.special ? "S00E"+special.pad(2) : s00e00} - {t}', db:'TheTVDB')
rename(file:files, format:episodeFormat, db:'TheTVDB', output:episodedir)
}
// MOVIE MODE
if (group.mov && !group.tvs) {
rename(file:files, format:'Movies/{n} ({y})/{n} ({y}){" CD$pi"}', db:'TheMovieDB')
}
}