2 issues with sortivo.groovy script

Any questions? Need some help?
Post Reply
belgarth
Posts: 30
Joined: 25 Jan 2012, 09:19

2 issues with sortivo.groovy script

Post 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)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 2 issues with sortivo.groovy script

Post 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.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 2 issues with sortivo.groovy script

Post 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')
	}
}
:idea: Please read the FAQ and How to Request Help.
Post Reply