Sort title in .nfo

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Boutzo
Posts: 6
Joined: 01 Jan 2025, 00:27

Sort title in .nfo

Post by Boutzo »

Is there a script or a way to change the format of how the <sorttitle> tag is processed? Right now it leaves the articles "The, A and An" at the beginning.

Ex. How it is now

Code: Select all

<sorttitle>A Christmas Story Collection :: 1983-01-01:: A Christmas Story<\sorttitle>
To

Code: Select all

<sorttitle>Christmas Story, A Collection :: 1983-01-01:: Christmas Story, A<\sorttitle>
The way it is now kind of defeats the purpose of sorting. Other nfo files usually leave it blank and either Plex or Jellyfin sorts it out. I've got alot of "The" movies in the "T" section.
Trying to look for an automated way to do this.
Even a regex solution in bulk rename utility would be appreciated
User avatar
rednoah
The Source
Posts: 24010
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sort title in .nfo

Post by rednoah »

:?: How did you generate these .nfo files? Are you using the amc script or the Export NFO files post-processing feature?


:idea: The amc script will generate .nfo files with the expected <sorttitle>. Here's what I get:

xml: Select all

<sorttitle>Christmas Story Collection :: Christmas Story :: 1983-11-18</sorttitle>

e.g.

Console Output: Select all

$ filebot -script fn:amc ./INPUT --output ./OUTPUT -non-strict --def artwork=y
...
[MOVE] from [INPUT/A Christmas Story.mkv] to [OUTPUT/Movies/A Christmas Story (1983) {tmdb-850}/A Christmas Story (1983).mkv]
...
Fetching movie artwork for [A Christmas Story (1983)] to [OUTPUT/Movies/A Christmas Story (1983) {tmdb-850}]
Generate Movie NFO: A Christmas Story [850]
...
$ cat 'OUTPUT/Movies/A Christmas Story (1983) {tmdb-850}/movie.nfo'
<movie>
  <title>A Christmas Story</title>
  <originaltitle>A Christmas Story</originaltitle>
  <sorttitle>Christmas Story Collection :: Christmas Story :: 1983-11-18</sorttitle>
...





EDIT:

I ran tests with the Export NFO files post-processing feature as well and can now confirm the issue:

Console Output: Select all

$ filebot -rename INPUT --db TheMovieDB --output OUTPUT -non-strict --apply nfo
...
[MOVE] from [INPUT/A Christmas Story.mkv] to [OUTPUT/A Christmas Story (1983).mkv]
[NFO] 850 (OUTPUT/movie.nfo)
...
$ cat 'OUTPUT/movie.nfo'
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<movie>
    <uniqueid type="tmdb">850</uniqueid>
    <title>A Christmas Story</title>
    <originaltitle>A Christmas Story</originaltitle>
    <sorttitle>A Christmas Story Collection :: 1983-11-18 :: A Christmas Story</sorttitle>
...





EDIT 2:

Fixed. FileBot r10465 will now ensure that --apply nfo generates <sorttitle> elements with Sort Name transformation applied to both collection name and movie name.
:idea: Please read the FAQ and How to Request Help.
Post Reply