Page 1 of 1

NFO files script does not respect order?

Posted: 08 May 2024, 03:08
by nateify
Hello, I am trying to use the NFO script from here and it is giving unexpected results: https://github.com/filebot/scripts/blob ... nfo.groovy

Let's use an example episode from X-Men (1992), with TheMovieDB episode mode, in production ordering. See here, 3x8 "No Mutant is an Island": https://www.themoviedb.org/tv/4574-x-me ... 6aaa4ab209

This episode is 5x4 in airdate ordering.

I rename the file using Filebot GUI and pick TMDB and production order, this gives the correct filename:
X-Men (1992) - 3x08 - No Mutant Is an Island.mkv

I have it generate .xattr. Here is the contents of net.filebot.metadata:

Shell: Select all

{"@type":"Episode","seriesName":"X-Men","season":3,"episode":8,"title":"No Mutant Is an Island","absolute":34,"airdate":{"year":1996,"month":9,"day":21},"id":330280,"group":"Season 3","seriesInfo":{"database":"TheMovieDB::TV","order":"Production","language":"en-US","type":"Scripted","id":4574,"name":"X-Men","aliasNames":["XMen","X-Men - The Animated Series","XMen The Animated Series","變種特工","变种特工","X-Men Animated Series","XMen Animated Series","Insuperabili X-Men","Insuperabili XMen","Oamenii-X","OameniiX","X - cilvēki","X Men, La Serie Animada","X-Men: A Série Animada","XMen A Série Animada","X-Men: Serie Animada","XMen Serie Animada","X战警","Люди Икс","Люди Ікс","Х-мен","Хмен","特異功能組","X-Men - A Série Animada","エックスメン","X-Men The Animated Series"],"certification":"TV-Y7","startDate":{"year":1992,"month":10,"day":31},"genres":["Kids","Sci-Fi & Fantasy","Animation","Action & Adventure"],"spokenLanguages":["en"],"network":"FOX","rating":8.197,"ratingCount":1108,"status":"Ended"}}
Note this value: "season":3,"episode":8 -- still correct so far.

When I then run the filebot nfo script, it still seems to detect 3x08:

Console Output: Select all

$ filebot -script fn:nfo "Y:\FilebotTest\X-Men (1992) - 3x08 - No Mutant Is an Island.mkv"
[EPISODE] X-Men - 3x08 - No Mutant Is an Island [Y:\FilebotTest\X-Men (1992) - 3x08 - No Mutant Is an Island.mkv]
Generate Series NFO: TheMovieDB::TV::4574 [Y:\.nfo]
Generate Episode NFO: X-Men - 3x08 - No Mutant Is an Island [Y:\FilebotTest\X-Men (1992) - 3x08 - No Mutant Is an Island.nfo]
Done ?(?????)?
However the final resulting NFO file has the wrong season and episode. It is still using the airdate order:

Code: Select all

<episodedetails>
  <uniqueid type='tmdb'>330280</uniqueid>
  <title>No Mutant Is an Island</title>
  <season>5</season>
  <episode>4</episode>
  <aired>1996-09-21</aired>
The expected result is to have season 3 and episode 8 inside this XML NFO file. Is there anything I am doing wrong or can something be changed in the NFO groovy script to accomplish this?

Thanks

Re: NFO files script does not respect order?

Posted: 08 May 2024, 08:58
by rednoah
The nfo script uses the Episode ID (e.g. 330280) to lookup the episode information. That way you will always get the official latest primary SxE numbers directly from the source, irregardless of your file name, official SxE numbers used at the time, FileBot preferences used at the time, etc. This is neither explicitly intended nor unexpected behavior, as this particular issue has simply not come up before.



:idea: You could probably rewrite the code to just use the number from the xattr metadata Episode object:
https://github.com/filebot/scripts/blob ... #L136-L137

diff: Select all

-				season(e.season)
-				episode(e.episode)
+				season(m.season)
+				episode(m.episode)
NOTE: this code does not account for multi-episode xattr metadata

Re: NFO files script does not respect order?

Posted: 09 May 2024, 01:10
by nateify
rednoah wrote: 08 May 2024, 08:58 The nfo script uses the Episode ID (e.g. 4574) to lookup the episode information. That way you will always get the official latest primary SxE numbers directly from the source, irregardless of your file name, official SxE numbers used at the time, FileBot preferences used at the time, etc. This is neither explicitly intended nor unexpected behavior, as this particular issue has simply not come up before.



:idea: You could probably rewrite the code to just use the number from the xattr metadata Episode object:
https://github.com/filebot/scripts/blob ... #L136-L137

diff: Select all

-				season(e.season)
-				episode(e.episode)
+				season(m.season)
+				episode(m.episode)
NOTE: this code does not account for multi-episode xattr metadata
Many thanks, I was able to modify the code to use episodePart.season and episodePart.episode to account for multi-episode parts and the resulting metadata works.

For future reference, could it be possible to have

Format: Select all

{info} or .info
return the metadata with another episode ordering set?

Re: NFO files script does not respect order?

Posted: 09 May 2024, 17:28
by rednoah
:idea: The {order} binding can be used to cross-reference and access different views of the same episode:

Console Output: Select all

$ filebot -list --db TheMovieDB::TV --q 4574 --format '{ episode } => { order.production.episode }'
...
X-Men - 5x04 - No Mutant Is an Island => X-Men - 3x08 - No Mutant Is an Island
...