Page 1 of 1

2 issues with sortivo.groovy script

Posted: 12 Mar 2012, 02:26
by belgarth
Hoping to get some help with 2 problems I found with the sortivo.groovy script.
1) It doesn't look like the script works with cd1/cd2 movies. I suspect it is because the .each that is used to go through the directory causes each of the multipart movie files to be looked at individually. Anyone have any ideas how to modify the script to get around this?

2) Getting the following java error everytime I run the script:
WARNING: java.security.AccessControlException: access denied (java.lang.RuntimePermission shutdownHooks)

Re: 2 issues with sortivo.groovy script

Posted: 12 Mar 2012, 03:06
by rednoah
1.Right, assumed TiVo is always one file per recording. But the script is useful in other cases as well. An easy fix is probably using .match(cdN) in the naming scheme.

2. Did you add -trust-script? That should fix it.

Re: 2 issues with sortivo.groovy script

Posted: 12 Mar 2012, 05:36
by rednoah
This script will first group all files by name (excluding clutter like CD1, CD2, ...) and then apply rename() to each batch, that'll make {pi} work.

Code: Select all

args.getFiles{ it.isVideo() }.groupBy{ net.sourceforge.filebot.media.MediaDetection.stripReleaseInfo(it.nameWithoutExtension) }.each{ name, files ->
	def tvs = detectSeriesName(files[0])
	def mov = detectMovie(files[0], false)
	
	println "$name [series: $tvs, movie: $mov]"
	
	// DECIDE EPISODE VS MOVIE (IF NOT CLEAR)
	if (tvs && mov) {
		if (name =~ "(?i:$tvs - .+)" || parseEpisodeNumber(name) || parseDate(name)) {
			println "Exclude Movie: $mov"
			mov = null
		} else if (detectMovie(files[0], true)) {
			println "Exclude Series: $tvs"
			tvs = null
		}
	}
	
	// EPISODE MODE
	if (tvs && !mov) {
		return rename(file:files, format:'{n} - {s00e00} - {t}', db:'TheTVDB')
	}
	
	// MOVIE MODE
	if (mov && !tvs) {
		return rename(file:files, format:'{n} ({y}){" CD$pi"}', db:'TheMovieDB')
	}
}