(ask) How to rename movie with filesize in gigabytes
-
- Posts: 4
- Joined: 25 Jan 2016, 11:07
(ask) How to rename movie with filesize in gigabytes
Hi Iam newbie
How to rename movie with filesize in gigabytes?
eg:
I Origins (1958)
become: I Origins (2.1)
or : I Origins (2.1 Gb)
Thanks for your help
How to rename movie with filesize in gigabytes?
eg:
I Origins (1958)
become: I Origins (2.1)
or : I Origins (2.1 Gb)
Thanks for your help
Last edited by randy030991 on 25 Jan 2016, 11:59, edited 1 time in total.
Re: (ask) How to rename movie with filesize in gigabytes
The latest revision does have the {megabytes} and {gigabytes} bindings.
With FileBot v4.6.1 and older you can always use file.length() to calculate the numbers you want though:
viewtopic.php?f=5&t=3283
With FileBot v4.6.1 and older you can always use file.length() to calculate the numbers you want though:
viewtopic.php?f=5&t=3283
-
- Posts: 4
- Joined: 25 Jan 2016, 11:07
Re: (ask) How to rename movie with filesize in gigabytes
so its like this?:rednoah wrote:The latest revision does have the {megabytes} and {gigabytes} bindings.
With FileBot v4.6.1 and older you can always use file.length() to calculate the numbers you want though:
viewtopic.php?f=5&t=3283
{n} {gigabytes}
or
{n} file.length({gigabytes})
sorry iam so newbie about code programming
thanks
Re: (ask) How to rename movie with filesize in gigabytes
More like this:
Code: Select all
{(file.length()/1e9).toFloat().round(1)} GB
-
- Posts: 10
- Joined: 20 Dec 2015, 15:54
Re: (ask) How to rename movie with filesize in gigabytes
I am the one who asked in the other thread that rednoah linked to. He helped out a great deal in getting me straightened out with my coding.
What I ended up with was two different codes. One for a MB file up to a GB and one for over a GB.
For files from 1-999MB I use this:
For files over 1000MB I use:
Not sure why the math is different but it works for when I add file size to the folders.
What I ended up with was two different codes. One for a MB file up to a GB and one for over a GB.
For files from 1-999MB I use this:
Code: Select all
({(file.length()/1024/1024).toFloat().round()})
Code: Select all
({(file.length()/1024/1048).toFloat().round()})
Re: (ask) How to rename movie with filesize in gigabytes
So you're switching your format for each file!? Just a condition that formats files differently depending on their file size.
Code: Select all
{file.length() < 1e6 ? (file.length()/1e6).toFloat().round() + ' MB' : (file.length()/1e9).toFloat().round(1) + ' GB'}
-
- Posts: 107
- Joined: 12 Apr 2020, 04:02
Re: (ask) How to rename movie with filesize in gigabytes
Is this supposed to display 0.8 GB ? Thought it'd use MB if inferior to 1 GB.rednoah wrote: ↑13 Mar 2016, 06:41 So you're switching your format for each file!? Just a condition that formats files differently depending on their file size.Code: Select all
{file.length() < 1e6 ? (file.length()/1e6).toFloat().round() + ' MB' : (file.length()/1e9).toFloat().round(1) + ' GB'}
Is there a way to use this on folders and have the linked srt going in the same 3 GB folder instead of a 0 MB one?
Re: (ask) How to rename movie with filesize in gigabytes
It should work by default, if you use {bytes}, or preferrably {gigabytes} in this case, unless it's an orphaned subtitle, in which case FileBot can't implicitly use the primary video file.AbedlaPaille wrote: ↑09 May 2020, 18:47 Is there a way to use this on folders and have the linked srt going in the same 3 GB folder instead of a 0 MB one?
Alternatively, you can always do your own size calculations based on the parent folder or something like that:
Code: Select all
{folder.files.sum{ it.length() }}
-
- Posts: 107
- Joined: 12 Apr 2020, 04:02
Re: (ask) How to rename movie with filesize in gigabytes
Wow we can make stuff happen depending on how many files are in? Cool.
{gigabytes} works great, just wanted 700 MO displayed instead of 0.7 GO in those < 1GO files.
{gigabytes} works great, just wanted 700 MO displayed instead of 0.7 GO in those < 1GO files.