comments in @file syntax?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
User avatar
mihawk90
Power User
Posts: 51
Joined: 18 Mar 2014, 00:41

comments in @file syntax?

Post by mihawk90 »

Been a while again... :)

I just fiddled around with the @file syntax you suggested to use here.
Apparently, comment's aren't stripped from the files when parsed?

My file (don't mind the format, I just copy&pasted what I already had, no work done):

Code: Select all

// test
any{order.airdate.s+'x'+order.airdate.es.join('-')+' ['+group+'] '+ episodes*.absolute*.pad(3).join('-')+' ['+crc32+']'}{fn}
And the output:

Code: Select all

Run script [fn:amc] at [Tue Mar 07 22:51:59 CET 2017]
Parameter: music = n
Parameter: artwork = n
Parameter: ut_label = TV_old
Parameter: ut_state = 5
Parameter: ut_title = Code Geass- Lelouch of the Rebellion [Hi10]
Parameter: ut_kind = single
Parameter: ut_file = (Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv
Parameter: ut_dir = C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion
Parameter: seriesFormat = // test
any{order.airdate.s+'x'+order.airdate.es.join('-')+' ['+group+'] '+ episodes*.absolute*.pad(3).join('-')+' ['+crc32+']'}{fn}
Input: C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion\(Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv
Group: [tvs:code geass lelouch of the rebellion] => [(Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [Code Geass Lelouch of the Rebellion]
Fetching episode data for [Code Geass: Lelouch of the Rebellion]
Apply filter [if (label == /TV_old/) return true; age < 30 || !model.any{ it.age < 30 }] on [79] items
Include [Code Geass: Lelouch of the Rebellion - 1x01 - The Day a New Demon was Born]
[...]
Include [Code Geass: Lelouch of the Rebellion - 2xSpecial 29 - Akito the Exiled: To Those Who are Precious]
[TEST] From [C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion\(Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv] to [\\ testany1x1 [Coalgirls] 001 [DC1BBB7A](Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv]
Processed 1 files
Finished without processing any files
Failure (°_°)
The same with multiline comments, just that I get this instead:

Code: Select all

Stripping invalid characters from new path: /* test */any1x1 [Coalgirls] 001 [DC1BBB7A](Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A)
[TEST] From [C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion\(Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv] to [C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion\test\any1x1 [Coalgirls] 001 [DC1BBB7A](Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv]
Am I doing it wrong? Those are the comment formats according to the docs.

Or is this working as intended and the file content just gets dumped into the argument?

Sysinfo:

Code: Select all

PS C:\Users\tarulia> filebot -script fn:sysinfo
FileBot 4.7.8 (r4846)
JNA Native: 5.1.0
MediaInfo: 0.7.92.1
7-Zip-JBinding: 9.20
Chromaprint: 1.4.2
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2017-02-20 (r481)
Groovy: 2.4.8
JRE: Java(TM) SE Runtime Environment 1.8.0_121
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 8 Core / 1 GB Max Memory / 36 MB Used Memory
OS: Windows 8.1 (amd64)
Package: MSI
Data: C:\Users\tarulia\AppData\Roaming\FileBot
Done ?(?????)?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: comments in @file syntax?

Post by rednoah »

1.
None of your logs show how you're using the @file so I can't tell you why it's not working.

Note that // is a Groovy comment, so it'll only work in Groovy code. The Groovy snippet you posted is invalid. Using any() suggests you're inside Groovy code, but using {fn} inside your Groovy code suggests that you're not.

e.g. YES

Code: Select all

{
// assign variable
def x = "fn = " + fn
return x
}
e.g. NO

Code: Select all

// literal string value
{
// some Groovy code
return fn
}

2.
any(Closure...) doesn't work the way you think it works:
viewtopic.php?f=5&t=1895
:idea: Please read the FAQ and How to Request Help.
User avatar
mihawk90
Power User
Posts: 51
Joined: 18 Mar 2014, 00:41

Re: comments in @file syntax?

Post by mihawk90 »

This is the line I call with (actually 2 more in a bat for testing):

Code: Select all

filebot -script fn:amc --log-file "C:\Users\tarulia\Documents\filebot\amc.log" --action test --conflict override -non-strict --filter "if (label == /TV_old/) return true; age < 30 || !model.any{ it.age < 30 }" --def music=n artwork=n "ut_label=TV_old" "ut_state=5" "ut_title=Code Geass- Lelouch of the Rebellion [Hi10]" "ut_kind=single" "ut_file=(Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv" "ut_dir=C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion" seriesFormat=@C:\Users\tarulia\Documents\filebot\seriesFormatWIP.groovy
I worked more with it yesterday and this is the updated groovy:

Code: Select all

{
//test
any{s.pad(2)+'x'+es*.pad(2).join('-') + ' ' +
 {defines.ut_title.contains('[Hi10') ? "[Hi10 via $group]" : "[$group]";} + ' ' +
 episodes*.absolute*.pad(3).join('-') +
 " [$crc32]"}
 {fn}
}
And this works, I was missing the outermost curly's (again) :)

There are some issues with that group format still, but still trying to figure this out (when the group isn't on the list, but it's a Hi10 release the name is generated without the group in between instead of failing completely). That doesn't happen all that much currently so it's not a huge deal for me :D but.. one day :) it's more fun fiddling around with it then actually using it anyway.

Thanks for the fast help again! :)

PS: Could I (or filebot) get banned by the TVDB API for "overusing" while testing? Don't really want to risk that... or is filebot caching the ZIPs returned by the API?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: comments in @file syntax?

Post by rednoah »

FileBot is heavily caching everything. You will not be able to get yourself banned with normal usage and testing like this. ;)

There is some developer options you can set if you want to see what kinda data FileBot is fetching.
:idea: Please read the FAQ and How to Request Help.
yob
Posts: 3
Joined: 03 Jul 2018, 22:32

Re: comments in @file syntax?

Post by yob »

rednoah wrote: 08 Mar 2017, 21:50 FileBot is heavily caching everything. You will not be able to get yourself banned with normal usage and testing like this. ;)

There is some developer options you can set if you want to see what kinda data FileBot is fetching.
Since there is no simple "Thanks Button". Thanks a lot, got it working :)
Post Reply