Rename Series Folders (i.e. add the {tmdb-id} marker to the folder name)

How-to guides, frequently asked questions, not-so-obvious features, etc
Post Reply
User avatar
rednoah
The Source
Posts: 23534
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Rename Series Folders (i.e. add the {tmdb-id} marker to the folder name)

Post by rednoah »

Rename Folders wrote:
rednoah wrote: 18 Nov 2020, 05:12 :!: You can only rename Movie / Episode folders, just like you can only rename Movie / Episode files. You cannot use Episode Mode to rename Series folders or Season folders. You can rename folders such as Avatar.2009 (Movie) or Alias.1x01 (Episode) but you cannot rename folders such as Alias (Series) or Season 1 (Season).
You cannot use Episode Mode to rename TV Series folders. You can however use Plain File Mode to rewrite any file name or file path. If you use Link-Drop to add Folder items (see Rename Folders) then you can rewrite folder names with your own custom format like any other file name.

Screenshot


e.g. find a file with xattr metadata within the given folder to generate a new name for the given folder:

Format: Select all

{
	def series = files.metadata.series.find()
	series.name + ' {tmdb-' + series.getExternalId('TheMovieDB') + '}'
}
Screenshot




e.g. use the filebot command-line tool to rename TV Series folders in the current directory:

Console Output: Select all

$ filebot -rename -d * --db file --format "{ def series = files.metadata.series.find(); series.name + ' {tmdb-' + series.getExternalId('TheMovieDB') + '}' }"
Rename files using [Plain File]
[MOVE] from [2001 - Alias] to [Alias {tmdb-2046}]

* ... all folders in the current working directory
-d ... process folder items
--db file ... use Plain File Mode




:!: The format above will fail if you attempt to process a folder that does not contain any files with xattr metadata:

Error: Select all

java.lang.NullPointerException: Cannot get property 'name' on null object
Screenshot
:idea: Please read the FAQ and How to Request Help.
Post Reply