Page 1 of 1

File size

Posted: 23 Dec 2015, 18:27
by nickodemos
I am a person who catalogs multiple movies but tend to have the size on the end of the folders to help differentiate between them.

The Female Animal (1958)(VHSRip)(1.36)
The Female Animal (1958)(VHSRip)(856)

Is there a way to place the site as in the example above to the end of a folder through Filebot?

Was also wondering about how to get riptypes like VHSRip, LaserRip, URip, Unknownrip types added so that filebot can then use them.

Re: File size

Posted: 24 Dec 2015, 04:49
by rednoah
1.
There's many ways... this is one of them:

Code: Select all

{file.length()/1e6 as int}
2.
If {tags} or {source} doesn't work, you can use the matchAll function on the filename. There's plenty of example in the forums.

Re: File size

Posted: 24 Dec 2015, 15:13
by nickodemos
rednoah wrote: 1.
There's many ways... this is one of them:

Code: Select all

{file.length()/1e6 as int}
2.
If {tags} or {source} doesn't work, you can use the matchAll function on the filename. There's plenty of example in the forums.
1.
This helped out a great deal. The 1e6 was a bust since it gave bytes and that was not what I was looking for. I did end up using {"${file.length()/1024/1000}"} but as you can see it gives me to much information. Is there a way to remove everything after the period?

The Walk (2015)(HDRip)(1473.989458984375)/The.Walk.(2015).480p.HDRip.XviD.AC3.2.0-EVO

I tried using the round option I found in another thread about ratings but can't seem to get that to work out.

Re: File size

Posted: 24 Dec 2015, 15:42
by rednoah
file.length() is the size in bytes, 1e6 is 1.000.000, and as int means as Integer, so no decimals.

Re: File size

Posted: 24 Dec 2015, 21:49
by nickodemos
rednoah wrote:file.length() is the size in bytes, 1e6 is 1.000.000, and as int means as Integer, so no decimals.
Yes I understand that. I even mentioned it in my thanks for giving it to me. Just was wondering about trying to get that round option to work with this or think you can point to me an example of how regex works with FileBot.

Re: File size

Posted: 24 Dec 2015, 22:01
by rednoah
1.
Round:

Code: Select all

{(file.length()/1e6).toFloat().round()}
2.
Groovy Regex:
http://naleid.com/blog/2008/05/19/dont-fear-the-regexp

Re: File size

Posted: 28 Dec 2015, 09:02
by rednoah
The latest revision adds convenience bindings for querying the filesize: {bytes}, {megabytes} and {gigabytes}

Re: File size

Posted: 06 Sep 2021, 21:18
by yocreoquesi
The bindings {bytes} {megabytes} and {gigabytes} are no longer INT on the latest Filebot version (tested with 4.9.4)

Re: File size

Posted: 07 Sep 2021, 00:06
by kim
maybe you find what you need ?

Code: Select all

{bytes.properties}
e.g.

Code: Select all

{bytes.value}
{bytes.MB}
{bytes.k}
{bytes.g}
{bytes.GB}
{bytes.KB}
{bytes.m}

Re: File size

Posted: 07 Sep 2021, 02:22
by rednoah
{bytes} is not longer a Number object, but you can get the long value (int won't work for large file size values) like so if you want to use it for mathematical operations:

Code: Select all

bytes.toLong()

Code: Select all

(bytes as long)

:?: What is your use case? Which mathematical operation do you need?


If you want a rounded decimal value for a specific file size unit, then this has gotten easier:

Code: Select all

megabytes.round(1)
or

Code: Select all

bytes.MB.round(1)


:!: Note that {megabytes} and {gigabytes} were always String values (i.e. number formatted to 1 decimal and unit) from the beginning. The new FileSize type aims to fix these inconsistencies.

Re: File size

Posted: 09 Sep 2021, 00:25
by nickodemos
Nice to hear this.