TvDB special position binding ?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
n1n1
Posts: 6
Joined: Yesterday, 12:57

TvDB special position binding ?

Post by n1n1 »

Hello.
due to recent emby update, some special episodes are nolonger ordered inside the whole season.
I have in mind to manually build a nfo file with filebot and setting this value from tvdb bindings.
Unfortunately I cannot manage to find the correct variable to use to retrieve this information.
For example, you can check this episode from Violet Evergarden https://thetvdb.com/series/violet-everg ... es/6497072
The special position noticed is : to be watched before S01E05.

Is this value handled by filebot and how to manage it inside a post processing script ?

Thank you,
User avatar
rednoah
The Source
Posts: 24351
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: TvDB special position binding ?

Post by rednoah »

:idea: Special Position: Airs before season 1, episode 5 seems to be something new. I'm not sure if the API makes this information even available. I'll have a look.

:arrow: You can probably use the episode airdate to sort episodes into the appropriate watch order.


EDIT
:idea: You can access the numbers via Groovy / Format code like so:

Format: Select all

{ episode.info.raw.airsBeforeSeason }

Format: Select all

{ episode.info.raw.airsBeforeEpisode }
EDIT 2
:idea: You'll want to use code like this to avoid unnecessary requests because we don't need episode details for non-special episodes:

Format: Select all

{ 
	def sbs = episode.special ? episode.info.raw.airsBeforeSeason : null
	def sbe = episode.special ? episode.info.raw.airsBeforeEpisode : null
	
	if (sbs && sbe) {
		' [Before S' + sbs.pad(2) + 'E' + sbe.pad(2) + ']'
	}
}
:idea: Please read the FAQ and How to Request Help.
n1n1
Posts: 6
Joined: Yesterday, 12:57

Re: TvDB special position binding ?

Post by n1n1 »

you're just a genius
I really do appreciate your quick and perfect answer :-)
really happy to have bought a licence
please keep satisfying users like this
wish you a nice 2026 !!
n1n1
Posts: 6
Joined: Yesterday, 12:57

Re: TvDB special position binding ?

Post by n1n1 »

is there any place where I can find all existing variables I can use ?
I may fill other elements in post processing for my nfo !
User avatar
rednoah
The Source
Posts: 24351
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: TvDB special position binding ?

Post by rednoah »

:idea: episode is a top-level binding. info will optionally give you an EpisodeDetails object. FileBot however does not have the airsBefore* properties in its model, so we need to use raw which gives us the raw JSON API response which happens to contain these airsBefore* properties if you're using TVDB.

:arrow: All top-level bindings: Format Expressions › Binding Reference

:arrow: General links to get started with the technical details: FileBot Groovy Expression Reference Documentation


EDIT
:idea: You'll want to use code like this to avoid unnecessary requests because we don't need episode details for non-special episodes:

Groovy: Select all

def sbs = episode.special ? episode.info.raw.airsBeforeSeason : null
def sbe = episode.special ? episode.info.raw.airsBeforeEpisode : null
	
if (sbs && sbe) {
	// do something for special episodes with airsBefore information
}
:idea: Please read the FAQ and How to Request Help.
n1n1
Posts: 6
Joined: Yesterday, 12:57

Re: TvDB special position binding ?

Post by n1n1 »

thank you for this useful clarification !
Post Reply