Hello, Gerrit!

On Wed, 2007-10-31 at 22:23 +0100, Gerrit Sangel wrote:
> I have extended the format_filesize() function from utils.py to format
> the bytesize into a correct way.
> 
> It now has 3 options, determined by a shell variable BYTEPREFIX
> 
> 1. If the variable is set to “off”, the string is formatted the usual
> way. So 20,000 Bytes are 19.53 “Kilo”bytes (the output is “19.53 KB”)
> 2. If the variable is set to “decimal”, it uses the SI units in the
> correct way. This way, 20,000 Bytes are exactly 20 Kilobytes.
> 20,000,000 Bytes are 20 Megabytes. The output is “20 KB” and so on.
> 3. If the variable is set to “binary”, it uses the Binary prefixes
> (Kibi, Mebi, Gibi). So 20,000 Bytes will become 19.53 Kibibyte. The
> output then is “19.53 KiB”.

Basically, you want to add support for the decimal output format of file
sizes. Why keep two different options for the same thing ("off" and
"binary"), apart from the added "i" in "MiB", "KiB" and "GiB".

> I have done this via a shell variable, because I think, it would be
> nice if the user could globally change the setting and then all
> applications with this feature would use the setting. I do not think
> it is very convenient if the user has to switch the setting each time
> in every appplication. This way, he could set the BYTEPREFIX variable
> and all applications could benefit. 

I've googled a bit for the "BYTEPREFIX" environment variable, and I
haven't found a project that uses this variable name for the same thing.

For this reason, I am against "inventing" a standard. If there is a
variable in POSIX or GNU that defines that behaviour, I'd be glad to add
support for that.

We can, however, add this as a configuration option to gpodder.conf and
not add configuration support for it in the GUI. This way, the UI does
not get too difficult, and interested users can still set their
preference in gpodder.conf.

> If somebody could look over the function and see if there are some
> flaws I did not see?

I will have a look as time permits. Here are some questions that I'm
still not sure about:

 -) What IS the standard of displaying file sizes? (KB[2], KB[10], KiB?)
 -) What is the benefit of providing "decimal" file sizes?
 -) It would modify the results of our speed/etc.. calculations, is
    that something we want or should avoid?


Thomas
_______________________________________________
gpodder-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/gpodder-devel

Reply via email to