remove only the primaryTitle year

Support for Windows 10 users and the Microsoft Store package
Post Reply
InMemoriam
Posts: 12
Joined: 12 Jun 2021, 10:17

remove only the primaryTitle year

Post by InMemoriam »

already I searched for the forum and I didn't find it.
I just wanted to remove the year from primaryTitle.
currently the one I use
.../{primaryTitle} ({y}) {primaryTitle == n ?' ': [n]}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{primaryTitle} - {episode.special ? 'S00E'+special.pad(2) : s00e00}
and so rich to rename :

..../Boku no Hero Academia (2021) (2016) [My Hero Academia]/Season 05/Boku no Hero Academia (2021) - S05E11

I would like to get this result :

..../Boku no Hero Academia (2016) [My Hero Academia]/Season 05/Boku no Hero Academia - S05E11

the primaryTitle is looking for the season date, and would like to remove that....

I appreciate any help in advance.
User avatar
rednoah
The Source
Posts: 20336
Joined: 16 Nov 2011, 08:59

Re: remove only the primaryTitle year

Post by rednoah »

e.g.

Code: Select all

{ primaryTitle.replaceTrailingBrackets() }
:idea: Please read the FAQ and How to Request Help.
InMemoriam
Posts: 12
Joined: 12 Jun 2021, 10:17

Re: remove only the primaryTitle year

Post by InMemoriam »

THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
User avatar
rednoah
The Source
Posts: 20336
Joined: 16 Nov 2011, 08:59

Re: remove only the primaryTitle year

Post by rednoah »

FileBot r8635 will apply replaceTrailingBrackets() implicitly for the {primaryTitle} binding.
:idea: Please read the FAQ and How to Request Help.
InMemoriam
Posts: 12
Joined: 12 Jun 2021, 10:17

Re: remove only the primaryTitle year

Post by InMemoriam »

I came across a complicated situation, usually the primarytitle gets the data in English, but here in this situation no, is there a way to configure it to pull in English only?
I'm doing dual name... the first one was getting in English as I wanted, but in this situation these 'special' characters were left, I think I'll convert it with the .ascii() parameter if I can't configure the primarytitle to English.
.../劇場版 美少女戦士セーラームーンEternal 前編 - Part 2 (2021) - [Pretty Guardian Sailor Moon Eternal: O Filme - Parte 2]/劇場版.美少女戦士セーラームーンEternal.前編.-.Part.2.2021 [TMDBID=784500]
User avatar
rednoah
The Source
Posts: 20336
Joined: 16 Nov 2011, 08:59

Re: remove only the primaryTitle year

Post by rednoah »

{primaryTitle} for TheMovieDB / Movie objects will give you the Original Title field, which is typically in the original language, which may or may not be English:
https://www.themoviedb.org/movie/618851 ... on-eternal


{primaryTitle} for TheTVDB / Episode objects will give you (A) the AniDB x-jat title, where TheTVDB <=> AniDB mappings are available or (B) the English title, in absence of Original Title information.




:!: {primaryTitle} is not your friend if you want English titles, especially not in combination with TheMovieDB.


:idea: If you want different components of your file path in different languages, then the {localize} dynamic localization binding is your friend.
:idea: Please read the FAQ and How to Request Help.
InMemoriam
Posts: 12
Joined: 12 Jun 2021, 10:17

Re: remove only the primaryTitle year

Post by InMemoriam »

the vestment

Code: Select all

String.transliterate(identifier)
I tried to use it but I'm not able to, little knowledge in programming.
wouldn't that be the solution? I put the .ascii but it is still some characters complicated to understand.
InMemoriam
Posts: 12
Joined: 12 Jun 2021, 10:17

Re: remove only the primaryTitle year

Post by InMemoriam »

rename my media with two names, the first would be english and the second in pt_br, if the first is equal to the second, do not insert the second. Many titles are doing well with the primarytitle, however when titles like Chinese, Japanese and others are these characters of their nationalities, I tried the .ascii() but I'm not getting much success.
User avatar
rednoah
The Source
Posts: 20336
Joined: 16 Nov 2011, 08:59

Re: remove only the primaryTitle year

Post by rednoah »

e.g. English Name - Brazilian Name or just English Name

Code: Select all

{ [n, localize.Brazilian.n].unique().join(' - ') }
:idea: Using default English language preferences, so n is in English.
:idea: Please read the FAQ and How to Request Help.
InMemoriam
Posts: 12
Joined: 12 Jun 2021, 10:17

Re: remove only the primaryTitle year

Post by InMemoriam »

YOU IS MY HERO!!!!
InMemoriam
Posts: 12
Joined: 12 Jun 2021, 10:17

Re: remove only the primaryTitle year

Post by InMemoriam »

rednoah wrote: 14 Jun 2021, 15:15 e.g. English Name - Brazilian Name or just English Name

Code: Select all

{ [n, localize.Brazilian.n].unique().join(' - ') }
:idea: Using default English language preferences, so n is in English.

this command does not have the same tv show effect when searching thetvdb, only tv show themoviedb, is there any special condition in question?! when searching thetvdb it returns Pt - Portugal themoviedb returns Pt - Brazil.
User avatar
rednoah
The Source
Posts: 20336
Joined: 16 Nov 2011, 08:59

Re: remove only the primaryTitle year

Post by rednoah »

Does TheTVDB have separate episode listings for Portuguese and Brazilian Portuguese?


EDIT:

Looks like TheTVDB API fundamentally doesn't differentiate these two languages:
https://forums.thetvdb.com/viewtopic.php?f=17&t=60522

:arrow: Best to stick to TheMovieDB if you need fine-grained localization. TheMovieDB had support for language / country localization from the very beginning, so it works better now.
:idea: Please read the FAQ and How to Request Help.
InMemoriam
Posts: 12
Joined: 12 Jun 2021, 10:17

Re: remove only the primaryTitle year

Post by InMemoriam »

rednoah wrote: 15 Jun 2021, 19:13 Does TheTVDB have separate episode listings for Portuguese and Brazilian Portuguese?
Some titles have both languages, I'll send you images...

Original Title...

Image

Portugues Portugal

Image

Portugues Brazil

Image

this code always pulls the portuguese portugal from thetvdb, but themoviedb comes correctly from portuguese brazil

Code: Select all

{ [n, localize.Brazilian.n].unique().join(' - ') }
User avatar
rednoah
The Source
Posts: 20336
Joined: 16 Nov 2011, 08:59

Re: remove only the primaryTitle year

Post by rednoah »

Unfortunately, the TheTVDB API only recognizes "pt" so FileBot can't request anything other than that, so there's nothing we can do to make it work at this point in time:
https://forums.thetvdb.com/viewtopic.php?f=17&t=60522
:idea: Please read the FAQ and How to Request Help.
InMemoriam
Posts: 12
Joined: 12 Jun 2021, 10:17

Re: remove only the primaryTitle year

Post by InMemoriam »

Look here again to bother me a little more...
You have the possibility to use this logic in FileBot, I'll try to describe what I have in mind as clearly as possible...
Where do I want to use dual titles in two languages

Using default English language preferences, so n is in English.

/media/PrimaryTitle "SecondTitlePT"/primarytitle.mkv

Code: Select all

if (PrimaryTitle =! SecondTitlePT && PrimaryTitle == SecondTitleEN){
	return 'SecondTitlePT';	
} else if (PrimaryTitle == SecondTitlePT && PrimaryTitle != SecondTitleEN) {
	return 'SecondTitleEN'
} else if (PrimaryTitle == SecondTitlePT && PrimaryTitle == SecondTitleEN){
	return '';
}
I tried to be as clear as possible, although my programming logic is weak, in the case of the second name the preference would be to use Portuguese, if Portuguese is the same as the primary, use English, if both Portuguese and English are the same as the primary, it would be blank the second title.
kim
Power User
Posts: 1211
Joined: 15 May 2014, 16:17

Re: remove only the primaryTitle year

Post by kim »

rewrote too working code (not tested), but I don't get the logic here ?

Code: Select all

{
	def priT = PrimaryTitle;
	def ptT = localize.por.n;
	
	(priT != ptT && priT == n)
		? ptT
		: (priT == ptT && priT != n) 
			? n
			: (priT == ptT && priT == n) 
				? n
				: ''
}
need a sample show/movie
prefer what lang ?
why prefer other lang ?
prefer what fallback lang ?

try:

Code: Select all

{ [n, PrimaryTitle != localize.por.n ? localize.por.n : ''].unique().join(' - ') }
User avatar
rednoah
The Source
Posts: 20336
Joined: 16 Nov 2011, 08:59

Re: remove only the primaryTitle year

Post by rednoah »

Yep, i think the best thing here is to start with listing 1 example movie ID + expected file name for each case that you want to cover.
:idea: Please read the FAQ and How to Request Help.
InMemoriam
Posts: 12
Joined: 12 Jun 2021, 10:17

Re: remove only the primaryTitle year

Post by InMemoriam »

the goal would be to have a dual name in the folder if the names were different from the primarytitle.
I'll try to describe a case, I put the code above trying to find a logic but it seems that complicated was more. The main name is immutable.

we assume that:

Code: Select all

PrimaryTittle = MovieA
Portuguese = MovieB
English = MovieC

if MovieA is different from MovieB
write = /home/Movies/MovieA - MovieB/MovieA.mvk

if MovieA is the same as MovieB and different from MovieC

write = /home/Movies/MovieA - MovieC/MovieA.mvk

now if the 3 titles are the same

write = /home/Movies/MovieA/MovieA.mvk
Using default English language preferences, so n is in English.
User avatar
rednoah
The Source
Posts: 20336
Joined: 16 Nov 2011, 08:59

Re: remove only the primaryTitle year

Post by rednoah »

I guess I understand the general idea, but I'd still need a few specific examples (i.e. TheMovieDB ID) that I can use for prototyping and testing.

e.g. like this:
* Format Avatar (2009) TMDB-19995 to "Avatar by James Cameron"
* ...
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1211
Joined: 15 May 2014, 16:17

Re: remove only the primaryTitle year

Post by kim »

then this should do it

Code: Select all

{ [n, PrimaryTitle != localize.por.n ? localize.por.n : primaryTitle].unique().join(' - ') }
Using default English language preferences, so n is in English
PrimaryTitle = PrimaryTitle (probably English)
Portuguese = localize.por.n
unique = if same only use n aka English
InMemoriam
Posts: 12
Joined: 12 Jun 2021, 10:17

Re: remove only the primaryTitle year

Post by InMemoriam »

kim wrote: 02 Oct 2021, 17:23 then this should do it

Code: Select all

{ [n, PrimaryTitle != localize.por.n ? localize.por.n : primaryTitle].unique().join(' - ') }
Using default English language preferences, so n is in English
PrimaryTitle = PrimaryTitle (probably English)
Portuguese = localize.por.n
unique = if same only use n aka English
return

/Tensei Shitara Slime Datta Ken (2018) That Time I Got Reincarnated as a Slime - Tensei Shitara Slime Datta Ken/Season 01/Tensei Shitara Slime Datta Ken - S01E01
InMemoriam
Posts: 12
Joined: 12 Jun 2021, 10:17

Re: remove only the primaryTitle year

Post by InMemoriam »

this is my current method

Code: Select all

{ primaryTitle.replaceTrailingBrackets() }
  {primaryTitle == localize.Brazilian.n?'':'- ' + [[localize.Brazilian.n]].unique().join(' - ') }/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{ primaryTitle.replaceTrailingBrackets() }
 - {episode.special ? 'S00E'+special.pad(2) : s00e00}
And that's what comes back to me, but so far, it's okay
/Tensei Shitara Slime Datta Ken/Season 01/Tensei Shitara Slime Datta Ken - S01E01
I wanted to put one more condition, as the secondary title is the same as the first one, that it would return another second secondary title in English, in case this one is not the same as the first one, in case there is no secondary title.


that's what I hope will return if the secondary title is equal to the first and a third condition.
/Tensei Shitara Slime Datta Ken - [That Time I Got Reincarnated as a Slime]//Season 01/Tensei Shitara Slime Datta Ken - S01E01
if the first condition and the second condition are equal to the main title that returns nothing.
kim
Power User
Posts: 1211
Joined: 15 May 2014, 16:17

Re: remove only the primaryTitle year

Post by kim »

looks like your default language is NOT set to English like you wrote ?

Code: Select all

Using default English language preferences, so n is in English.
default English

Code: Select all

{[PrimaryTitle, n != localize.por.n ? '['+n+']' : '['+localize.por.n+']'].unique()*.replaceTrailingBrackets().join(' - ') }/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{primaryTitle.replaceTrailingBrackets()}{' - '+any{episode.special ? 'S00E'+special.pad(2):''}{s00e00}}
default Portuguese

Code: Select all

{[n, PrimaryTitle != localize.eng.n ? '['+localize.eng.n+']' : '['+primaryTitle+']'].unique()*.replaceTrailingBrackets().join(' - ') }/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{primaryTitle.replaceTrailingBrackets()}{' - '+any{episode.special ? 'S00E'+special.pad(2):''}{s00e00}}
output:
Tensei Shitara Slime Datta Ken - [That Time I Got Reincarnated as a Slime]/Season 01/Tensei Shitara Slime Datta Ken - S01E01

BUT the Brackets F the unique up
Post Reply