[Script] Fetch Artwork Collection

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
User avatar
rednoah
The Source
Posts: 24033
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

[Script] Fetch Artwork Collection

Post by rednoah »

Fetch Movie Artwork Collection

e.g. Fetch artwork and fanart for newly processed movie files:
** requires FileBot r10650 or higher

Groovy: Select all

{ source, target, metadata ->
	allOf{ movie.artwork }{ movie.fanart }
	.flatten()
	.findAll{ a -> a.language == null || a.language ==~ /en/ }
	.groupBy{ a -> a.tags.grep(~/[a-z]+|[0-9]+/).join('_') }
	.each{ group, artwork ->
		artwork.take(5).eachWithIndex{ a, i ->
			curl a.url, target.dir / 'artwork' / "${group}-${i+1}.${a.extension}"
		}
	}
}


Fetch Series Artwork Collection

e.g. Fetch artwork and fanart for newly processed series / episode files:
** requires FileBot r10650 or higher

Groovy: Select all

{ source, target, metadata ->
	allOf{ series.artwork }{ series.fanart }
	.flatten()
	.findAll{ a -> a.language == null || a.language ==~ /en/ }
	.groupBy{ a -> a.tags.grep(~/[a-z]+|[0-9]+/).join('_') }
	.each{ group, artwork ->
		artwork.take(5).eachWithIndex{ a, i ->
			curl a.url, target.dir.dir / 'artwork' / "${group}-${i+1}.${a.extension}"
		}
	}
}


List Artwork Collection

e.g. List all available artwork:

Groovy: Select all

{ source, target, metadata ->
	allOf{ movie.artwork }{ movie.fanart }{ series.artwork }{ series.fanart }
	*.each{ a -> println a }
}
:idea: Please read the FAQ and How to Request Help.
Post Reply