Solved, removing (US) from {ny} tag using TheTVDB with GUI windows

All about user-defined episode / movie / file name format expressions
Post Reply
nyxtyr
Posts: 16
Joined: 17 Nov 2020, 17:19

Solved, removing (US) from {ny} tag using TheTVDB with GUI windows

Post by nyxtyr »

Hello, I want to remove (US), (UK) and other country codes from a TV show title using TheTVDB. For example "Hell's Kitchen (US) (2005) {imdb-tt0437005}" => "Hell's Kitchen (2005) {imdb-tt0437005}" for the folder names then "Season 01\Hell's Kitchen (2005) - S01E01 - Day 1.mp4"

I am using GUI on windows.

Eventually I would also like to use CLI on windows and also CLI on TrueNAS

Here is my code so far. It does everything I need so far with the exception of removing the (US)|(UK)|(KR)

Code: Select all

C:/TV Shows/{ny} {"{imdb-tt${omdb.imdbId.pad(7)}}"}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{ny} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')}{'.'+lang}

System Information

Code: Select all

FileBot 4.9.4 (r8736)
JNA Native: 6.1.0
MediaInfo: 20.09
7-Zip-JBinding: 16.02
Tools: fpcalc/1.5.0
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2021-08-02 (r761)
Groovy: 3.0.8
JRE: OpenJDK Runtime Environment 16.0.2
JVM: 64-bit OpenJDK 64-Bit Server VM
CPU/MEM: 12 Core / 8 GB Max Memory / 130 MB Used Memory
OS: Windows 10 (amd64)
STORAGE: NTFS [(C:)] @ 757 GB
DATA: C:\Users\admin\AppData\Roaming\FileBot
Package: MSI
License: FileBot License PXxxxxxxx (Valid-Until: 2069-10-11)
Screenshot
Image

File paths as text

Code: Select all

Hell's Kitchen (US) (2005) {imdb-tt0437005}\Season 01\Hell's Kitchen (US) (2005) - S01E01 - Day 1.mp4	{"@type":"Episode","seriesName":"Hell's Kitchen (US)","season":1,"episode":1,"title":"Day 1","airdate":{"year":2005,"month":5,"day":30},"id":157294,"seriesInfo":{"database":"TheTVDB","order":"DVD","language":"en-US","type":"TV Series","id":74897,"name":"Hell's Kitchen (US)","aliasNames":["Hells Kitchen","Gordon Ramsay Hells Kitchen","Gordon Ramsays Hoellenkueche","Кухнята на ада","Gordon Ramsay: Pekelná kuchyně","Gordon Ramsay - A pokol konyhája","Elles ķēķis","Piekielna kuchnia Gordona Ramsaya","Bucătăria Iadului","Адская кухня","Pekelná kuchyňa","地狱厨房","美版地獄廚房","地狱厨房 (美版)"],"certification":"TV-14","startDate":{"year":2005,"month":5,"day":30},"genres":["Food","Game Show","Reality"],"network":"FOX","rating":8.2,"ratingCount":1237,"runtime":45,"status":"Continuing"}}
Hell's Kitchen (US) (2005) {imdb-tt0437005}\Season 01\Hell's Kitchen (US) (2005) - S01E01 - Day 1.eng.vtt	{"@type":"Episode","seriesName":"Hell's Kitchen (US)","season":1,"episode":1,"title":"Day 1","airdate":{"year":2005,"month":5,"day":30},"id":157294,"seriesInfo":{"database":"TheTVDB","order":"DVD","language":"en-US","type":"TV Series","id":74897,"name":"Hell's Kitchen (US)","aliasNames":["Hells Kitchen","Gordon Ramsay Hells Kitchen","Gordon Ramsays Hoellenkueche","Кухнята на ада","Gordon Ramsay: Pekelná kuchyně","Gordon Ramsay - A pokol konyhája","Elles ķēķis","Piekielna kuchnia Gordona Ramsaya","Bucătăria Iadului","Адская кухня","Pekelná kuchyňa","地狱厨房","美版地獄廚房","地狱厨房 (美版)"],"certification":"TV-14","startDate":{"year":2005,"month":5,"day":30},"genres":["Food","Game Show","Reality"],"network":"FOX","rating":8.2,"ratingCount":1237,"runtime":45,"status":"Continuing"}}
Last edited by nyxtyr on 01 Nov 2021, 01:43, edited 1 time in total.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Help, removing (US) from {ny} tag using TheTVDB

Post by kim »

like this:

Code: Select all

"Hell's Kitchen (US) (2005)".replaceAll(/\(\D{2}\)\s?/)

https://regexr.com/
nyxtyr
Posts: 16
Joined: 17 Nov 2020, 17:19

Re: Help, removing (US) from {ny} tag using TheTVDB

Post by nyxtyr »

Code: Select all

C:/TV Shows/{ny.replaceAll(/\(\D{2}\)\s?/)} {"{imdb-tt${omdb.imdbId.pad(7)}}"}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{ny.replaceAll(/\(\D{2}\)\s?/)} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')}{'.'+lang}
Working perfect so far after a few tests everything seems good. Thank you!
User avatar
rednoah
The Source
Posts: 23928
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Solved, removing (US) from {ny} tag using TheTVDB with GUI windows

Post by rednoah »

FileBot provides a String.replaceTrailingBrackets() extension method for this kind of use case:

Code: Select all

{n.replaceTrailingBrackets()} ({y})
That being said, using regex is a much versatile approach, since the same concept can be applied to all kinds of replacement use cases, not just this particular one.
:idea: Please read the FAQ and How to Request Help.
nyxtyr
Posts: 16
Joined: 17 Nov 2020, 17:19

Re: Help, removing (US) from {ny} tag using TheTVDB

Post by nyxtyr »

nyxtyr wrote: 01 Nov 2021, 01:43

Code: Select all

C:/TV Shows/{ny.replaceAll(/\(\D{2}\)\s?/)} {"{imdb-tt${omdb.imdbId.pad(7)}}"}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{ny.replaceAll(/\(\D{2}\)\s?/)} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')}{'.'+lang}
Working perfect so far after a few tests everything seems good. Thank you!
This was working perfect till today. For some reason it's cutting off the season folder and S00 in the filename.

What it is suppose to do is: "Hell's Kitchen (US) (2005) {imdb-tt0437005}" => "Hell's Kitchen (2005) {imdb-tt0437005}" for the folder names then "Season 01\Hell's Kitchen (2005) - S01E01 - Day 1.mp4"

What it is doing is: "Hell's Kitchen (US) (2005) {imdb-tt0437005}" => "Hell's Kitchen (2005) {imdb-tt0437005}" for the folder names then "Hell's Kitchen (2005) - E01 - Day 1.mp4" < The season folder and S00 is being removed.


Any hot shots out there think they can fix it?

Code: Select all

FileBot 5.1.3 (r10185)
JNA Native: 6.1.6
MediaInfo: 23.10
7-Zip-JBinding: 16.02
Tools: fpcalc/1.5.0
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2024-05-12 (r962)
Groovy: 4.0.15
JRE: OpenJDK Runtime Environment 17.0.8
JVM: OpenJDK 64-Bit Server VM
CPU/MEM: 16 Core / 8 GB Max Memory / 257 MB Used Memory
OS: Windows 11 (amd64)
STORAGE: NTFS [(C:)] @ 1.3 TB | NTFS [Record1] @ 39 MB | NTFS [Record2] @ 511 GB | NTFS [BACKUP] @ 1.0 TB | NTFS [media01] @ 3.7 TB | NTFS [media02] @ 1.8 TB | NTFS [media03] @ 2.8 TB | NTFS [media04] @ 5 TB
DATA: C:\Users\user\AppData\Roaming\FileBot
Package: MSI
License: FileBot License xxxxxxxxx (Valid-Until: 2069-10-11)
nyxtyr
Posts: 16
Joined: 17 Nov 2020, 17:19

Re: Solved, removing (US) from {ny} tag using TheTVDB with GUI windows

Post by nyxtyr »

Sorry but the problem I was having is fixed.

I had absolute selected.
Post Reply