[Script] Generate .plexmatch files

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

[Script] Generate .plexmatch files

Post by rednoah »

This post-processing script for Episode Mode will generate .plexmatch files after episodes have been renamed and organized into season folders:

Groovy: Select all

{ source, target ->
	NEWLINE(target.dir / '.plexmatch')
		{ "Title: $n" }
		{ "Year: $y" }
		{ if (s) "Season: $s" }
		{ if (tmdbid) "tmdbid: $tmdbid" }
		{ if (tvdbid) "tvdbid: $tvdbid" }
		{ if (e) "Episode: ${e.pad(2)}: $target.name" }
		{ if (special) "Episode: SP${special.pad(2)}: $target.name" }
}

Console Output: Select all

$ ls -a
.plexmatch
Alias - S01E01 - Truth Be Told.mkv
Alias - S01E02 - So It Begins.mkv
Alias - S01E03 - Parity.mkv
...

Properties: Select all

Title: Alias
Year: 2001
Season: 1
tmdbid: 2046
tvdbid: 75930
Episode: 01: Alias - S01E01 - Truth Be Told.mkv
Episode: 02: Alias - S01E02 - So It Begins.mkv
Episode: 03: Alias - S01E03 - Parity.mkv
...
:idea: Please read the FAQ and How to Request Help.
Post Reply