Advanced Format Help

All about user-defined episode / movie / file name format expressions
User avatar
rednoah
The Source
Posts: 23936
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to concatenate

Post by rednoah »

Just because some people get the service for free doesn't make it any less valuable. ;)

I'm happy to help. But since your requirements are quite complex and a bit fluid it's best to deal with simple components that you can then copy and paste together, and thus easy rearrange and extend as you change your mind. ;)

Try to snippets above and let me know if there's any functionality you want missing.


EDIT:

If in the end you're not happy with the result, no need to pay anything. No worries. It's just the kind of thread that keeps going on for days and in the end it's just not worth my time. I'm of course happy to help with any specific questions (custom tags, resolution, French name, replace colon, etc) because those answers will be useful to the community as a whole. :ugeek:
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23936
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Advanced Format Help

Post by rednoah »

Once your format logic exceeds a certain level complexity, a less declarative and more programmatic format coding style might be preferable, to reuse logic and avoid repetition.

e.g.

Code: Select all

{
  def ns = allOf{ localize.French.name }
                { localize.English.name }
                { y as String }
                { resolution }
           *.upperInitial()
           *.slash(' - ')
           *.colon(' - ')

  def nsy = ns.head() + ns.tail().collect{ " ($it)" }.join()
  def vff = '(VFF-NOT-IMPLEMENTED)'

  allOf{
    allOf{ if (y < 1980) 'Classic' }{ if (genres =~ /Horror/) 'Horror' }{ 'Movies' }
  }{
    allOf{ nsy }{ "($ac)" }{ vff }
  }{
    allOf{ nsy }{ vff }{ "($imdbid)" }
  }
  *.join(' ').join('/')
}
:idea: Please read the FAQ and How to Request Help.
Dio
Posts: 14
Joined: 17 May 2016, 13:14

Re: Advanced Format Help

Post by Dio »

Hello rednoah,

I'm sorry for my silence, I was in the hospital and due to chemotherapy practiced emergency I am not emerged before this afternoon.

I'm too tired to try now, maybe tomorrow or later, but thanks for your job, I see at least one more reply, (I haven't read it atm).

I'll reply you later, and test your code when I can.

thanks in advance.
Best regards.
User avatar
rednoah
The Source
Posts: 23936
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Advanced Format Help

Post by rednoah »

Dio wrote:chemotherapy
Wow. :o No worries! I hope you're alright! Let me know if you need more help with your custom tags.
:idea: Please read the FAQ and How to Request Help.
Dio
Posts: 14
Joined: 17 May 2016, 13:14

Re: Advanced Format Help

Post by Dio »

Hello Rednoah,

All is not rosy, my results do beings not very good, they have set me another session. thank you for your concern.

I'm afront my computer, not for a long time (I'm really tired), can you please let me know where I must test this ?

Code: Select all

{
  def ns = allOf{ localize.French.name }
                { localize.English.name }
                { y as String }
                { resolution }
           *.upperInitial()
           *.slash(' - ')
           *.colon(' - ')

  def nsy = ns.head() + ns.tail().collect{ " ($it)" }.join()
  def vff = '(VFF-NOT-IMPLEMENTED)'

  allOf{
    allOf{ if (y < 1980) 'Classic' }{ if (genres =~ /Horror/) 'Horror' }{ 'Movies' }
  }{
    allOf{ nsy }{ "($ac)" }{ vff }
  }{
    allOf{ nsy }{ vff }{ "($imdbid)" }
  }
  *.join(' ').join('/')
}
How I should use it ?

On the last topic I've see a FileBot version for Synology NAS, could it be a better way for me ?

I will give a try to Filebot for Synology to see how it works.

Thanks for your help rednoah.

Best regards,
Dio.
User avatar
rednoah
The Source
Posts: 23936
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Advanced Format Help

Post by rednoah »

The GUI application is definitely the best way for testing and prototyping custom formats.

You'd just copy & paste the format into the Format Editor and then try it on a few files:
Image

I wouldn't worry about automation on the NAS yet, if you're still working on figuring out the format you want.
:idea: Please read the FAQ and How to Request Help.
Dio
Posts: 14
Joined: 17 May 2016, 13:14

Re: Advanced Format Help

Post by Dio »

Thank you rednoah,

sorry for my late reply, I thought be rested enough to stay in front of my puter, but it was not the case ...

So, I'll give a try, I've put all the code below inot Filebot Editor, but it won't work I got : "SyntaxError: expecting EOF, found 'def'

I'm probably not using the right code ?

Code: Select all

{
  def ns = allOf{ localize.French.name }
                { localize.English.name }
                { y as String }
                { resolution }
           *.upperInitial()
           *.slash(' - ')
           *.colon(' - ')

  def nsy = ns.head() + ns.tail().collect{ " ($it)" }.join()
  def vff = '(VFF-NOT-IMPLEMENTED)'

  allOf{
    allOf{ if (y < 1980) 'Classic' }{ if (genres =~ /Horror/) 'Horror' }{ 'Movies' }
  }{
    allOf{ nsy }{ "($ac)" }{ vff }
  }{
    allOf{ nsy }{ vff }{ "($imdbid)" }
  }
  *.join(' ').join('/')
}
User avatar
rednoah
The Source
Posts: 23936
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Advanced Format Help

Post by rednoah »

1.
I see. I guess that one will only work with the latest build.

This will work with 4.7.2 and older releases:

Code: Select all

{
  def ns = allOf{ localize.French.name }
                { localize.English.name }
                { y as String }
                { resolution }
           *.upperInitial()
           *.slash(' - ')
           *.colon(' - ');

  def nsy = ns.head() + ns.tail().collect{ " ($it)" }.join();
  def vff = '(VFF-NOT-IMPLEMENTED)';

  allOf{
    allOf{ if (y < 1980) 'Classic' }{ if (genres =~ /Horror/) 'Horror' }{ 'Movies' }
  }{
    allOf{ nsy }{ "($ac)" }{ vff }
  }{
    allOf{ nsy }{ vff }{ "($imdbid)" }
  }
  *.join(' ').join('/')
}

2.
rednoah wrote:You have way too many tags. Dealing with them is your job now. This format bit will read a given *.csv file, so you can manage your tags yourself.

Code: Select all

{csv('/path/to/dio.csv').findResults{ p, t -> fn.contains(p) ? " ($t)" : null}.join()}
dio.csv

Code: Select all

VFF;VFF
ac3;AC3
...
You can also start playing with your custom tags if you want. Here's the full format for that:

Code: Select all

{
  def ct = '/path/to/my-custom-tags.csv';

  def ns = allOf{ localize.French.name }
                { localize.English.name }
                { y as String }
                { resolution }
           *.upperInitial()
           *.slash(' - ')
           *.colon(' - ');

  def nsy = ns.head() + ns.tail().collect{ " ($it)" }.join();
  def vff = csv(ct).findResults{ p, t -> fn.contains(p) ? " ($t)" : null}.join() ?: null;

  allOf{
    allOf{ if (y < 1980) 'Classic' }{ if (genres =~ /Horror/) 'Horror' }{ 'Movies' }
  }{
    allOf{ nsy }{ "($ac)" }{ vff }
  }{
    allOf{ nsy }{ vff }{ "($imdbid)" }
  }
  *.join(' ').join('/')
}
:idea: Please read the FAQ and How to Request Help.
Post Reply