[Anime] How do I process files with absolute numbers on the command-line?

All your suggestions, requests and ideas for future development
Post Reply
sagenth
Posts: 5
Joined: 11 Oct 2022, 23:59

[Anime] How do I process files with absolute numbers on the command-line?

Post by sagenth »

I'm trying to rename some files, and they came with the episode number in the series. It seems to be messing up the matches.
The format is: `E.000.S00.e00_title`
example: `E.091.S05.e15_...`

I'll probably just do a `find . -exec rename ... \;` to remove it, but it'd be nice if this really robust software just supported it. As that was all I wanted to change with the renaming. However since I'm doing this to get libreELEC to recognize the show and list it and its episodes.. I may need to only use that episode number. Not so easy to revert a massive reductive rename operation.

I actually just took a spin over to https://anidb.net/anime/11210 and it seems anidb even uses this series episode number to list episodes.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Series Episode Number

Post by rednoah »

:?: Do you have logs or screenshots? Can you paste a specific file path that doesn't work? Please read How to Request Help.


e.g. E000 pattern works with Absolute Order:

Code: Select all

$ filebot -rename *.mp4 --db TheTVDB --order Absolute -non-strict --log INFO
[MOVE] from [One.Piece.E1035.mp4] to [One Piece - 1035 - The Beasts Trampled! The End of the Kozuki Family!.mp4]
e.g. E000 pattern works with Airdate SxE Order but this may not always work, it's complicated:

Code: Select all

$ filebot -rename *.mp4 --db TheTVDB --order Airdate -non-strict --log INFO
[MOVE] from [One.Piece.E1035.mp4] to [One Piece - 21x144 - The Beasts Trampled! The End of the Kozuki Family!.mp4]
e.g. S00E00 pattern typically takes precedence over the E000 pattern, but other factors such as episode title can turn things around:

Code: Select all

$ filebot -rename *.mp4 --db TheTVDB --order Airdate -non-strict --log INFO
[MOVE] from [One.Piece.E.1034.S21.E144.mp4] to [One Piece - 21x144 - The Beasts Trampled! The End of the Kozuki Family!.mp4]


:idea: If you're using KODI then you will want to use the {kodi.id} format format when renaming:

Code: Select all

{ kodi.id }

:!: If you use TheTVDB / Airdate SxE Numbers in KODI, then you must rename files with TheTVDB / Airdate SxE Numbers. If you use AniDB / Absolute Numbers in KODI, then you must rename files with AniDB / Absolute Numbers. And so on and so forth. If you switch between different databases and episode orderings within the same library, then you're gonna a hard time sooner or later when you run into a corner cases where things happen to not be the same across all databases.





EDIT:


:!: AniDB notably does not have the concept of "seasons" so if you match SxE numbers against AniDB information, then behaviour is rather undefined:

Code: Select all

$ filebot -rename *.mp4 --db AniDB --order Absolute -non-strict --log INFO
[MOVE] from [One.Piece.E1035.S21.E144.mp4] to [One Piece - 144 - Caught Log! The King of Salvagers, Masira!.mp4]
This is an unfortunate corner case... I'll look into it...


:idea: However, the S01E01 numbers do tell us that --db AniDB is wrong for these files in the first place, because AniDB doesn't have SxE numbers, so the files must have been named against TheTVDB or TheMovieDB::TV so we need to set the database accordingly. If we want to match files against TheTVDB numbers but rename against AniDB episode information, then the --mapper option can help us do just that:

Code: Select all

$ filebot -rename *.mp4 --db AniDB --order Absolute -non-strict --mapper AnimeList.TheTVDB --log INFO
[MOVE] from [One.Piece.E1035.S21.E144.mp4] to [One Piece - 1035 - The Animal Kingdom Pirates Trample Down! The End of the Kozuki Clan!.mp4]

:arrow: tl;dr you'll want to use --db TheTVDB --order Airdate to process your files because that's what matches your files, and because you're using KODI which does use TheTVDB / Airdate SxE Numbers by default (unless you have configured your KODI libraries otherwise)
:idea: Please read the FAQ and How to Request Help.
sagenth
Posts: 5
Joined: 11 Oct 2022, 23:59

Re: Series Episode Number

Post by sagenth »

I eventually `perl-rename`d the files to something that worked though not on aniDB or TheTVDB. I'll take another crack at things tomorrow with all this information you've shared; I'm hoping there is a tidbit in here that'll help me use filebot to get what I currently have `{n} [{E}] - {s}x{e.pad(2)}` and then also get back the titles that I dropped along the way (where {E} is my way to denote the absolute number). Thank you!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Series Episode Number

Post by rednoah »

If you have {n} [{E}] - {s}x{e.pad(2)} then the [{E}] part will be ignored entirely and the {s}x{e.pad(2)} part will be used to match the file to the episode information. So it'll work assuming that you use TheTVDB or TheMovieDB::TV and AirDate SxE Order and that the SxE in your selected database matches the SxE in your files. So if something doesn't work, we'll need logs / specific file paths for testing, because the issue will likely be specific to the file name / series / episode you're trying to process.
:idea: Please read the FAQ and How to Request Help.
sagenth
Posts: 5
Joined: 11 Oct 2022, 23:59

Re: Series Episode Number

Post by sagenth »

A couple problems.

The first one is more of a grip single dashes are for shorthand and double dashes are for full word options so: -h --help
But the real annoying part is the CLI options aren't self-consistent.

The second is there doesn't appear to be a --dry-run option on command line, so I'm hesitant to try running any commands
The third in the GUI I can't find a way to use these mapper options.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Series Episode Number

Post by rednoah »

1.
-- is for options that take one or more arguments, and - is for flags / options that don't take any arguments. filebot does not follow the GNU-style -shortopt --longopt convention and has only 1 option key per option for the sake of simplicity:
https://www.filebot.net/cli.html

:?: Which specific CLI options are not self-consistent? (NOTE: -script and -exec are indeed inconsistent for historical reasons)



2.
--action TEST can be used instead of --action MOVE to do nothing:
viewtopic.php?t=4915



3.
The GUI does not have a --mapper option equivalent for the sake of simplicity.

:arrow: The typical use case (i.e. match against TheTVDB and then rename against AniDB or vice versa) can be achieved by matching against TheTVDB and then mapping to AniDB episode information at format time:

Code: Select all

$ filebot -rename *.mp4 --db TheTVDB --order Airdate --format "{ db.AniDB.plex.id }" -non-strict --log INFO --action TEST
[TEST] from [One.Piece.E.1034.S21.E144.mp4] to [Anime/One Piece {anidb-69}/One Piece - 1035 - The Animal Kingdom Pirates Trample Down! The End of the Kozuki Clan.mp4]


:?: Are you using the GUI? Screenshots? Are you using the CLI? Logs?
:idea: Please read the FAQ and How to Request Help.
sagenth
Posts: 5
Joined: 11 Oct 2022, 23:59

Re: Series Episode Number

Post by sagenth »

Ah ok, they are self-consistent with that convention then. GNU conventions would be nice, but I think I at least understand things enough now.
I wonder if it could be worth the effort to calculate absolute numbers when seasonal information is available, without the need for mapping.

I missed the test action when reading the help, thanks for pointing me to it! And thank you for all the help.
I'll report back how things go.

edit: Okay seems like my use case isn't supported by these options. Try as I might I can't seem to find a way to keep both season/episode and absolute. The format I'm shooting for is something along the lines of (probably subject to tweaking, like dropping the show name changing the episode info positioning)

Code: Select all

{n} [{absolute}] - {s}x{e} - {t}
Episode {absolute} [{s}x{e}] - {t}
Something like that, I thought I might have access to both sets of properties with the mapper but that doesn't seem to be the case.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Series Episode Number

Post by rednoah »

:?: What is your use case?

:?: Can you provide a specific example that doesn't work?

:?: What is the file path you have? What is the file path you want?

:?: What database do you intend to use?


:idea: Adding both SxE and Absolute numbers to the target file name should generally work just work:

Code: Select all

$ filebot -list --q "One Piece" --db TheTVDB --format "{n} - {s00e00} [{absolute.pad(2)}] - {t}" | head
One Piece - S01E01 [01] - I'm Luffy! The Man Who's Gonna Be King of the Pirates!
One Piece - S01E02 [02] - Enter the Great Swordsman! Pirate Hunter Roronoa Zoro!
One Piece - S01E03 [03] - Morgan versus Luffy! Who's the Mysterious Pretty Girl?
One Piece - S01E04 [04] - Luffy's Past! Enter Red-Haired Shanks!
One Piece - S01E05 [05] - A Terrifying Mysterious Power! Captain Buggy, the Clown Pirate!
One Piece - S01E06 [06] - Desperate Situation! Beast Tamer Mohji Vs. Luffy!
One Piece - S01E07 [07] - Epic Showdown! Swordsman Zoro Vs. Acrobat Cabaji!
One Piece - S01E08 [08] - Who Is the Victor? Devil Fruit Power Showdown!
One Piece - S02E01 [09] - The Honorable Liar? Captain Usopp!
One Piece - S02E02 [10] - The Weirdest Guy Ever! Jango the Hypnotist!
...
** but might not work depending on your chosen database and the specific series / episode at hand in cases where the information you seek isn't supported or hasn't been entered yet
:idea: Please read the FAQ and How to Request Help.
sagenth
Posts: 5
Joined: 11 Oct 2022, 23:59

Re: Series Episode Number

Post by sagenth »

Okay, so I went back today to renaming these files. I had been trying to use mazetv (I think was the db name) as it was what I had to use in kodi to detect the show properly so I figured it was a data thing.. (maybe using --q helped avoid issues) but anyways long story short I just went and used thetvdb to match with no mapper option and it seemingly has worked. Though there were errors, it wasn't related to matching or renaming. Here's the output

Code: Select all

josh@Janus /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga 
$ filebot --q "Dragon Ball Super" -rename *.mkv --log INFO --format "Episode {absolute} - [{s}x{e.pad(2)}] - {t}" --db thetvdb
[Thu 20:09:37]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [15] - 2x01.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 15 - [2x01] - Valiant Mr. Satan, Work a Miracle! A Challenge from Outer Space!.mkv]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [16] - 2x02.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 16 - [2x02] - Vegeta Becomes a Student! Win Over Whis!.mkv]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [17] - 2x03.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 17 - [2x03] - Pan is Born! And Goku Goes on a Training Journey!.mkv]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [18] - 2x04.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 18 - [2x04] - I'm Here, Too! Training Commences on Beerus' World.mkv]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [19] - 2x05.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 19 - [2x05] - Despair Redux! The Return of the Evil Emperor, Frieza!.mkv]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [20] - 2x06.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 20 - [2x06] - A Warning from Jaco! Frieza and 1,000 Soldiers Close In.mkv]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [21] - 2x07.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 21 - [2x07] - The Start of Vengeance! The Frieza Force's Malice Strikes Gohan!.mkv]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [22] - 2x08.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 22 - [2x08] - Change! An Unexpected Return! His Name is Ginyu!!.mkv]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [23] - 2x09.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 23 - [2x09] - Earth! Gohan! Both on the Ropes! Hurry and Get Here, Goku!!.mkv]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [24] - 2x10.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 24 - [2x10] - Clash! Frieza vs. Goku! This is the Result of My Training!.mkv]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [25] - 2x11.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 25 - [2x11] - A Full-Throttle Battle! The Vengeful Golden Frieza.mkv]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [26] - 2x12.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 26 - [2x12] - A Chance Appears in a Tight Spot! Launch a Counteroffensive, Goku!.mkv]
[MOVE] from [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Dragon Ball Super [27] - 2x13.mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 27 - [2x13] - The Earth Explodes A Decisive Kamehameha!.mkv]
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 15 - [2x01] - Valiant Mr. Satan, Work a Miracle! A Challenge from Outer Space!.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 16 - [2x02] - Vegeta Becomes a Student! Win Over Whis!.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 17 - [2x03] - Pan is Born! And Goku Goes on a Training Journey!.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 18 - [2x04] - I'm Here, Too! Training Commences on Beerus' World.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 19 - [2x05] - Despair Redux! The Return of the Evil Emperor, Frieza!.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 20 - [2x06] - A Warning from Jaco! Frieza and 1,000 Soldiers Close In.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 21 - [2x07] - The Start of Vengeance! The Frieza Force's Malice Strikes Gohan!.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 22 - [2x08] - Change! An Unexpected Return! His Name is Ginyu!!.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 23 - [2x09] - Earth! Gohan! Both on the Ropes! Hurry and Get Here, Goku!!.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 24 - [2x10] - Clash! Frieza vs. Goku! This is the Result of My Training!.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 25 - [2x11] - A Full-Throttle Battle! The Vengeful Golden Frieza.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 26 - [2x12] - A Chance Appears in a Tight Spot! Launch a Counteroffensive, Goku!.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Failed to set xattr: /nas/media/television/Dragon Ball/Dragon Ball Super/2.Frieza Saga/Episode 27 - [2x13] - The Earth Explodes A Decisive Kamehameha!.mkv: Error writing extended attribute 'net.filebot.metadata': Operation not supported
After spending maybe 30-40m on it, I'm presuming xattr isn't possible with my setup as I can't control the fstab of the NAS. Never used it before, and I guess I don't need to start now.

Anyways so now that I've got Super renamed perfectly I moved on to Kai, it does not work well.

TVmaze, I've truncated this

Code: Select all

$ filebot --q "Dragon Ball Kai" -rename -r "./Dragon Ball Kai/" --log INFO --format "[{s}x{e.pad(2)}] Episode {absolute} - {t}" -no-xattr --action TEST --order absolute --db tvmaze
[Thu 21:37:43]
[TEST] from [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 2 (Frieza Saga)/[AnimeRG] Dragon Ball KAI - 051 [1080p] [x265] [pseudo].mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 2 (Frieza Saga)/[2x51] Episode - Buu is Overwhelmed! Ultimate Gohan's Super Power.mkv]
[TEST] from [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 2 (Frieza Saga)/[AnimeRG] Dragon Ball KAI - 052 [1080p] [x265] [pseudo].mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 2 (Frieza Saga)/[2x52] Episode - Buu's Trick - Gotenks is Absorbed!.mkv]
[TEST] from [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 6 (Majin Buu Saga)/[AnimeRG] Dragon Ball KAI - 127 [1080p] [x265] [pseudo].mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 6 (Majin Buu Saga)/[1x27] Episode - A Hair-Trigger Pinch! Gohan, Protect the Four Star Ball.mkv]
[TEST] from [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 6 (Majin Buu Saga)/[AnimeRG] Dragon Ball KAI - 128 [1080p] [x265] [pseudo].mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 6 (Majin Buu Saga)/[1x28] Episode - The Super Decisive Battle Draws Near! The Ginyu Special Force Has Arrived!.mkv]
It doesn't match correctly, and it doesn't have absolute numbers.

thetvdb:

Code: Select all

$ filebot --q "Dragon Ball Kai" -rename -r "./Dragon Ball Kai/" --log INFO --format "[{s}x{e.pad(2)}] Episode {absolute} - {t}" -no-xattr --action TEST --order absolute --db thetvdb
[Thu 21:41:10]
[TEST] from [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 1 (Saiyan Saga)/[AnimeRG] Dragon Ball KAI - 001 [1080p] [x265] [pseudo].mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 1 (Saiyan Saga)/[x01] Episode 1 - Prologue to Battle! The Return of Goku.mkv]
[TEST] from [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 1 (Saiyan Saga)/[AnimeRG] Dragon Ball KAI - 002 [1080p] [x265] [pseudo].mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 1 (Saiyan Saga)/[x02] Episode 2 - The Enemy is Goku's Brother! The Secret of the Mighty Saiyan Warriors.mkv]
[TEST] from [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 1 (Saiyan Saga)/[AnimeRG] Dragon Ball KAI - 003 [1080p] [x265] [pseudo].mkv] to [/nas/media/television/Dragon Ball/Dragon Ball Kai/Season 1 (Saiyan Saga)/[x03] Episode 3 - A Life or Death Battle! Goku and Piccolo's Desperate Attack!.mkv]
matches perfectly, but can't read the season information visible for the show on the site.

And anidb, doesn't match any of "season 2" from what I'm guessing based on the site.. they seem to have them broken into separate shows.. duumb.. but not something I expect to be solved by this.

When I plopped this into the GUI TheTVDB didn't have any fields with a value 2 so, I don't know why.. but filebot can't see the season info tvdb has.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Series Episode Number

Post by rednoah »

Re: xattr
You can use -no-xattr to make the errors go away. Alternatively, you can configure FileBot to store xattr metadata into plain text files.



Re: TVmaze
TVmaze does not support absolute numbers, and FileBot does not "invent" them, though you could "invent" them in your custom format. Notably, TVmaze is only used by a very small minority of users. I'd generally recommend using what everybody else is using, i.e. TheTVDB or TheMovieDB/TV.



Re: Kodi
If you're using Plex / Kodi / etc then the general way of doing things is to configure either TheTVDB or TheMovieDB/TV there, and then use only that chosen database when renaming files with FileBot, and only that chosen database. That way files will always match up perfectly in Plex / Kodi / etc. If the files you have don't match the information in the database you have chosen, then you need to translate (painstakingly via manual matching if necessary) the naming and number as dictated by your chosen database.

:!: Switching between different databases depending on the files at hand can make things easier at first when processing files with FileBot, and might be viable if you're only naming files your yourself, but might cause trouble later when your files are not consistently named and numbered, because Plex / Kodi / etc can't know which database you have chosen for any one particular file or series.



Re: AniDB and season numbers
AniDB doesn't have seasons. Each "season" is a separate series with a different series name. Sometimes they just add "2nd Season" to the name. Sometimes just an extra "!!" at the end. Sometimes a completely different name. If you use {s} with AniDB episode information, then FileBot try to infer the number you seek via AnimeLists / TheTVDB / TheMovieDB / etc.



Re: TheTVDB and absolute numbers
TheTVDB does support absolute numbers, but the absolute number may or may not have been added yet for any one particular episode.

This case should work though, because someone has already done the work:

Code: Select all

$ filebot -list --db TheTVDB --q "Dragon Ball KAI" --format "{sxe} | {absolute} | {t}" | grep 128
2x23 | 128 | The Nightmare Returns, The Immortal Monster, Majin Buu
Nope! The 1st failed attempt teaches us that we need to focus on the absolute numbers, since 128 can be interpreted as either S01E28 or E128:

Code: Select all

$ filebot -rename "Dragon Ball KAI - 128.mp4" --db TheTVDB -non-strict --log INFO --action TEST
[TEST] from [Dragon Ball KAI - 128.mp4] to [Dragon Ball Kai - 1x28 - The Super Decisive Battle Draws Near! The Ginyu Special Force Has Arrived!.mp4]
Almost! The 2nd attempt will give us the correct match, but... How do I convert Absolute numbers to Airdate SxE numbers?

Code: Select all

$ filebot -rename "Dragon Ball KAI - 128.mp4" --db TheTVDB --order Absolute -non-strict --log INFO --action TEST
[TEST] from [Dragon Ball KAI - 128.mp4] to [Dragon Ball Kai - 128 - The Nightmare Returns, The Immortal Monster, Majin Buu.mp4]
** {s} {e} {sxe} {s00e00} and friends work differently depending on the episode information at hand; if we're using --order absolute then {s} is undefined and {e} is the absolute number

Success! The 3rd attempt is just copy & paste from Option C: Use the --mapper command-line option to match files with one order but rename with another order

Code: Select all

$ filebot -rename "Dragon Ball KAI - 128.mp4" --db TheTVDB --mapper order.absolute.episode --format "{n} - {s00e00} - E{absolute} - {t}" -non-strict --log INFO --action TEST
[TEST] from [Dragon Ball KAI - 128.mp4] to [Dragon Ball Kai - S02E23 - E128 - The Nightmare Returns, The Immortal Monster, Majin Buu.mp4]
Bonus! What if we can't use --mapper because we're using the FileBot Desktop application? Then Option B: Use the dynamic {order} binding to match TheTVDB / Absolute episodes to TheTVDB / Airdate SxE episodes will have to do:

Code: Select all

$ filebot -rename "Dragon Ball KAI - 128.mp4" --db TheTVDB --order Absolute --format "{n} - {order.airdate.s00e00} - E{absolute} - {t}" -non-strict --log INFO --action TEST
[TEST] from [Dragon Ball KAI - 128.mp4] to [Dragon Ball Kai - S02E23 - E128 - The Nightmare Returns, The Immortal Monster, Majin Buu.mp4]
:idea: And once our "convert absolute to SxE numbers" command has proven itself, we can then pack all that complexity into a custom command-line tool and use that instead in the future.
:idea: Please read the FAQ and How to Request Help.
Post Reply