help with upper() and replace() for text/audio.language

Support for Windows users
Post Reply
vampirzocker
Posts: 9
Joined: 07 Oct 2016, 15:54

help with upper() and replace() for text/audio.language

Post by vampirzocker »

hi im new in this and tried customize my renaming but coudnt get it to work...

{n} - {s00e00} - {t} DUB-{audio.language} SUB-{text.language}{if (file.issubtitle) fn =~ /[.]eng$/ ? '.eng' : '.ger' }{'.'+fn.match(/forced/)} [{vf}]

i wanted to make the languages in caps but with ".upper()" it didnt work for it... dont know why... seems like this expression works only for this 1-2 letters long expressions....

then i wanted to replace the commas in {text/audio.languages} (originally i had preferred to restructure it completely in [DUB-LANG-LANG] with exact 3 letters) but that is far away from my knowledge to syntax i guess xD

has someone some code already or could someone help please?


ps the last command is obviously coppy and paste, i dont understand this myself even when i searched for fn description i dont get it and the symbols before and after eng eng ger etc dont make any sense to me xD haha
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with upper() and replace() for text/audio.language

Post by rednoah »

1.
{audio} is a List of Audio MediaInfo. Thus {audio.language} is a List of language properties for each audio stream, and you want to call upper() for each of those.

Hence:

Code: Select all

{audio.language*.upper()}
If you want to convert List of Text objects to a single Text object then you can call the join() method with your preferred separator character.


2.
All that subtitle logic can probably be replaced with the {subt} binding.
:idea: Please read the FAQ and How to Request Help.
vampirzocker
Posts: 9
Joined: 07 Oct 2016, 15:54

Re: help with upper() and replace() for text/audio.language

Post by vampirzocker »

much appreciated for the help xD

could help me with replace() too?

i tried it with {n}:
i go with replaceall().... the whole name vanished
i go with replace()... and the whole name would be like that Firefly : [F,i,r,e,f,l,y,] or with replacement like "-" :
[-F-,-i-,-r-,-e-,-f-,-l-,-y-]

edit it was because of the "*" but in audio.language i couldnt get it to work though
vampirzocker
Posts: 9
Joined: 07 Oct 2016, 15:54

Re: help with upper() and replace() for text/audio.language

Post by vampirzocker »

nevermind read just now that with join()

now its working like a charm thx xD
vampirzocker
Posts: 9
Joined: 07 Oct 2016, 15:54

Re: help with upper() and replace() for text/audio.language

Post by vampirzocker »

i tried subt already at the end with simply ...{subt}

but it doesnt give me any result
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with upper() and replace() for text/audio.language

Post by rednoah »

{subt} will only yield results for subtitle files. People are usually confused by their own text environment (e.g. sample file).
:idea: Please read the FAQ and How to Request Help.
vampirzocker
Posts: 9
Joined: 07 Oct 2016, 15:54

Re: help with upper() and replace() for text/audio.language

Post by vampirzocker »

i dont get it xD

my subtitles are dedicated subtitles as idx, subs
(ok i guess idx arent real subtitles for itself but they hold format infos or not?)
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with upper() and replace() for text/audio.language

Post by rednoah »

{subt} is based on statistical language detection which doesn't work on bitmap images. The idx/sub pairs are binary files, not text files, so it won't work.

Any self-respecting data hoarder will use srt subtitles which are text based and infinitely better in every aspect. {subt} works for standard subtitles. {subt} does not work for ancient idx/sub bitmap subtitles, but you can always stick to the hard-coded logic you're using in the OP.
:idea: Please read the FAQ and How to Request Help.
vampirzocker
Posts: 9
Joined: 07 Oct 2016, 15:54

Re: help with upper() and replace() for text/audio.language

Post by vampirzocker »

now i get what you mean

didnt know that the difference lies in something like that... thought the whole time that the subtitles would look different to srts because of the idx files

but although you say something like that....are there srts with individual color, display position and fonts?

else i dont get why you would say "any self-respecting data hoarder" and "infinitely better(for what)"?
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with upper() and replace() for text/audio.language

Post by rednoah »

SRT is the most popular format because it's simple and without all that fancy crap you don't want anyway. The Anime folks do need something fancy so they use SSA.

IDX/SUB is the equivalent of writing an email, then taking a screenshot of the text, then deleting the text and sending the screenshot instead. It was made for DVD players from pre-2000 that didn't have enough CPU / RAM to render text.
:idea: Please read the FAQ and How to Request Help.
vampirzocker
Posts: 9
Joined: 07 Oct 2016, 15:54

Re: help with upper() and replace() for text/audio.language

Post by vampirzocker »

so ssa subs would be text based and would still have this unique kind of displaying?

i searched via google and the result is for me, all have the same opinion like you, they are nearly disgusting fancy and a load of issues in it xD but i like SSAs

i watched now a comparison in quality of vobsubs....i never saw this, but they are realy bad in quality and never noticed it xD haha

thx for this enlightment xD
vampirzocker
Posts: 9
Joined: 07 Oct 2016, 15:54

Re: help with upper() and replace() for text/audio.language

Post by vampirzocker »

is there a way to make

Code: Select all

{text.language*.upper().join("-").replace("DE","DEU").replace("JA","JAP").replace("EN","ENG")}}+"-SUB]"}
a boolean to fold/unfold?

or could you tell me the syntax of " if(text.language== is not null) "

everytime if i make it a boolean its true because null is a value....
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with upper() and replace() for text/audio.language

Post by rednoah »

I don't know what you mean. Empty List and null are false according to Groovy Truth. The expression you posted is not valid neither.


I'd do it like this:

Code: Select all

{def x = text.language.findResults{ it.toLocale().ISO3Language.upper() }.join('-'); if (x) "[$x-SUB]"}
:idea: Please read the FAQ and How to Request Help.
vampirzocker
Posts: 9
Joined: 07 Oct 2016, 15:54

Re: help with upper() and replace() for text/audio.language

Post by vampirzocker »

dont know either i made it at 4am xD

but wow thx would i have known that i can just use this xD

but really thx, im bad in such things when it comes to "x=results *results cached* *if there cached results* *make "x-sub"*" (is that right?)
Post Reply