Lots of questions about basic custom formats

Running FileBot from the console, Groovy scripting, shell scripts, etc
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Lots of questions about basic custom formats

Post by kim »

Maybe this will help ;)

Code: Select all

{def FirstLanguage = languages[0]; (FirstLanguage =~ 'French') ? 'French Films'+'/'+localize.French.name+'('+y+')'+'/'+fn : ((FirstLanguage =~ 'English') ? 'English Movies'+'/'+localize.English.name+'('+y+')'+'/'+fn : 'Unknown')}
try

Code: Select all

{localize.English}
e.g.

Code: Select all

{localize.English.Actors}

Code: Select all

{localize.English.SpokenLanguages.join('')}
macdalor
Posts: 33
Joined: 14 Apr 2016, 17:14

Re: Lots of questions about basic custom formats

Post by macdalor »

I'm back :)
I am running the following script

Code: Select all

{languages[0] =~ 'Spanish|French' ? localize[languages[0]].name : n} ({y})
{def FirstLanguage = languages[0]; (FirstLanguage =~ 'French') ? 'French Films'+'/'+localize.French.name+'('+y+')'+'/'+fn : ((FirstLanguage =~ 'English') ? 'English Movies'+'/'+localize.English.name+'('+y+')'+'/'+fn : 'Unknown')}
and I am getting the following result
http://s32.postimg.org/s8rtqyndh/Screen ... _50_33.jpg
I wanted to show you what I tried to explain above regarding the folders creation, file by file...
What is it I am not doing correctly?
Last edited by macdalor on 17 May 2016, 20:16, edited 2 times in total.
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Lots of questions about basic custom formats

Post by rednoah »

Do you expect me to hack into your machine just so I can see the screenshot you saved on your desktop, Mr Producer? Sry, can't be bothered. Try again. This time try uploading the screenshot somewhere, ok? ;)


PS: You did not read or understand how {expressions} work.
:idea: Please read the FAQ and How to Request Help.
macdalor
Posts: 33
Joined: 14 Apr 2016, 17:14

Re: Lots of questions about basic custom formats

Post by macdalor »

rednoah wrote:Do you expect me to hack into your machine just so I can see the screenshot you saved on your desktop, Mr Producer? Sry, can't be bothered. Try again. This time try uploading the screenshot somewhere, ok? ;)
:D I like to sense of humour... ;)

I saw this about the img and currently trying sorting out...bear with me please :)
macdalor
Posts: 33
Joined: 14 Apr 2016, 17:14

Re: Lots of questions about basic custom formats

Post by macdalor »

here you go

ps: thx for your patience ;)
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Lots of questions about basic custom formats

Post by rednoah »

* What do you want?
* How is it different from what you get?
* Which part of the format does not behave the way you'd expect?

Answer these questions using specific examples.
:idea: Please read the FAQ and How to Request Help.
macdalor
Posts: 33
Joined: 14 Apr 2016, 17:14

Re: Lots of questions about basic custom formats

Post by macdalor »

rednoah wrote: PS: You did not read or understand how {expressions} work.
I haven't read this yet...bed time reading I guess :)
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Lots of questions about basic custom formats

Post by rednoah »

If the first language is neither French nor German, the your second {expression} will yield just "Unknown", not a folder structure like in the other two cases.


EDIT:


Sigh, at this point, just giving you the solution would have more cost-effective for me...


Part 1:

Code: Select all

{any{[French: 'French Films', English: 'English Movies'][languages[0]]}{'Foreign Movies'}}
Part 2:

Code: Select all

{any{localize[languages[0].match(/Spanish|French/)].name}{n}} ({y})
Part 3:

Code: Select all

{primaryTitle} ({y})
Copy & paste these things together, add some / in between, however you want. I already don't remember your exact rules.


Now you owe me a tutorial where you explain what you've learned, or a donation, your choice.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Lots of questions about basic custom formats

Post by kim »

Why / how does this work ?
{[French: 'French Films', English: 'English Movies'][languages[0]]}
([LinkedHashMap] [arraylist])

is it a filebot thing or "org. code" ?
do you have a link ?
is there a way to write it, so I know how it works ?
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Lots of questions about basic custom formats

Post by rednoah »

Standard Groovy. Nothing fancy about it.

@see http://groovy-lang.org/groovy-dev-kit.h ... p_literals
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Lots of questions about basic custom formats

Post by kim »

sry still don't get why/how it works?

under "Filtering and searching" ?

same?
{def lang = [French: 'French Films', English: 'English Movies'].findAll{ it.key == languages[0]}; lang.values().join('')}
or
{[French: 'French Films', English: 'English Movies'].get(languages[0])}
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Lots of questions about basic custom formats

Post by rednoah »

map[x] is the same as map.get(x)

Code: Select all

assert map.get('name') == 'Gromit'
assert map['name'] == 'Gromit'
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Lots of questions about basic custom formats

Post by kim »

thx
macdalor
Posts: 33
Joined: 14 Apr 2016, 17:14

Re: Lots of questions about basic custom formats

Post by macdalor »

rednoah wrote:Now you owe me a tutorial where you explain what you've learned, or a donation, your choice.
Rednoah, although I am still testing this script (have been away much recently) & don't have all elements still, I'll donate for your great help and patience as I think it'll help you more than a tutorial from someone who doesn't understand much (although highly willing to!)...it'll just take a bit of time as I'm not very often home or with time to take care of this...but I'll do it at some point... :)
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Lots of questions about basic custom formats

Post by rednoah »

No worries. My tutorials are detailed and technical so pretty hard to understand if you don't have certain basics.

Just write it as if you'd explain it to a friend. I'm sure many people will appreciate newbie oriented tutorials and explanations. If something is wrong, I'll just correct it for you. ;)
:idea: Please read the FAQ and How to Request Help.
macdalor
Posts: 33
Joined: 14 Apr 2016, 17:14

Re: Lots of questions about basic custom formats

Post by macdalor »

rednoah wrote:No worries. My tutorials are detailed and technical so pretty hard to understand if you don't have certain basics.

Just write it as if you'd explain it to a friend. I'm sure many people will appreciate newbie oriented tutorials and explanations. If something is wrong, I'll just correct it for you. ;)
so you prefer a newbie tut than a donation then... :shock:
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Lots of questions about basic custom formats

Post by rednoah »

Pretty much. :D
:idea: Please read the FAQ and How to Request Help.
Post Reply