Status Bar Graph for DVD+R size

I can't seem to get the status bar graph to work quite right. Hopefully this is something I'm just doing wrong.
Here is the part of the status bar I'm working on:

{sbL}
{bg+V=sbL/4700372992,W=50,F=2,L=2,G=0,C1=#00FF00,C2=#EEEE40,C3=#EE4040,B=#000000}

I want it so that when I go over 4,700,372,992 bytes, the graph turns red. (4,700,372,992 bytes is the max DVD+R size from Wikipedia)
With the actual bytes selected shown in the status bar {sbL}, I am able to go up to about 4,746,436,758 and it still shows yellow. If I select a bit more than that, it finally turns red.
The bar graph C3 color is supposed to take effect when the equation goes over 100% but it changes color a bit later for unknown reasons.

Other sizes have the same kind of problem where I can select more bytes than specified in the equation before C3 is activated.

I also tried different settings for the equation:
bg+V=sbL/4700372992
bg+V=sbL/4700372992b
bg+V=sbL/4700372992B
bg+V=sbL/4700372992bits
bg+V=sbL/4700372992Bits

They all seem to do the same thing. Close but not quite there.

How do I fix this?

Use 4.5g instead of 4700372992 etc.

At least, that works in Tanis's status bar here: Status Bar codes

Aha... be careful when talking about what specific value to use - as doing so may send us spiraling into the great debate over how kb/mb/gb are calculated :slight_smile:...

Wikipedia
Answers.com
Byte Conversion Calculator

Either way - the reason that your current status bar code doesn't set the graph exactly as you'd expect is likely do to some math that I'm assuming is taking place...

Consider your example: based on some quick trial and error - a status bar code using V=sbL/4700372992 goes over threshold (red) at exactly 4,747,376,722 bytes selected... with the resulting value of sbL/4700372992 being 1.010; while just a single byte less results in a value of 1.009. I expect that the code that controls this part of the status bar might only be using a 2-point unit of precision... which might be rather trivial when operating with GB or even MB values; but down at the "byte" level, and with such a relatively 'large' byte value, Opus would need to use a pretty crazy unit of precision to make the bar graph go over threshold at a byte accurate level... at least- that's what I assume is happening, or something close.

Anyhow, I think that maybe a good middle ground (as opposed to using some crazy unit of precision that might still not work if some fool were to express a 2 TB drive in terms of bytes :slight_smile:) might be for Opus to provide an additional way of triggering the bar graph to go over threshold. I think many people like Orbidia are less interested in using the bar graph to see a "percentage" expression for which a "ballpark" value will usually suffice, so much as a measure of space remaining against a hard value... maybe some additional control codes along with some additional text and even some calculation capabilities would make more sense for such use cases... something like:

{wtree}{h!}<#ff0000>{hi} hidden</#> {i:/jtools\icons\sep.ico} {h!}{i:dir} <#0000ff>{sd}/{td} folders</#> {i:/jtools\icons\sep.ico} {i:.txt} {sf}/{tf} files
{bg+c1=#408000,c2=#ffff00,c3=#ff000,t=no,g=2,f=2,v=sbL-{$v=4700372992}} <#408000>{sbLa} selected</#>{h+}<#ff0000>, {{$v} - {sbLa}} remaining...</#>{h+} {rpad}
{bg+c1=#408000,c2=#ffff00,c3=#ff000,t=yes,g=2,f=2} <#408000>{df} free</#>

The exact syntax involved not-withstanding - I guess I'm suggesting that some additional use of V in the {bg} code be allowed such that you could:

a) set a hard or calculated value in {bg,V=) by which the graph would go over threshold...
b) use that value for other calculations which you could use to provide additional status bar messages...

In the pseudo-example above, I'm thinking that that if the number of selected bytes in sbL is greater than a status bar variable {$v} set to = 4700372992, then set the graph over threshold... then also use some sort of hidden string control that will hide the contents if the section is <= to zero (I guess {h+} makes sense for that) to provide an additional message that uses a value calculated from the hard value and the selected file sizes to message how much space remains before you'll go over threshold.

This sort of mod to the staus bar codes would seem much more useful for the typical use-case of determining how much data you could select in order to fill a DVD to the brim...?

Dunno - just thinking "out loud".

Does 4.5g not work or something?

Well - it'll "work" - but I don't think 4.5g is necessarily the "right" size for a DVD... certainly not if you're counting at a BYTE level like the OP. I'd long had mine set to 4.3g - though if you take the byte value he cited from Wikipedia you get that to equate to 4.3775634765 gb...

Anyhow, my point was really that for somebody who is trying to pack as much as they can onto a DVD, the way the percentage value is calculated can cause them to "lose out" on a bit of space if using the Opus status bar method alone. In this case maybe about 40-something MB... which "somebody" out there might care about...

Nothing to interfere efforts on copy queues and whatever whiz-bang features GPSoft are cooking up for the next version over IMO...

By "it'll work" I meant that the status bar might seem to be "more correct" in terms of when the bar graph decides to go over threshold. But again, I think that'd have to do more with the "scale" things appear to be represented at - than any changee in how the "math" appears to be working. You could easily have 40-something MB difference in selected data and still see 4.something GB in the status bar and be none the wiser...

Then again - it's all academic anyway with some media allowing you to store slightly more/less than the specification calls for. Either way - I was simply intrigued that Opus wasn't bumping the bar graph over the threshold correctly, and now I guess I know why - maybe. Man, I feel enriched... something to pass some time sitting in the hospital anyway.

I'm guessing that no byte amount would be entirely correct as the actual amount would vary depending on number of files/folders and other metadata. It's always going to be a rough estimate at the end of the day.

Thanks steje for looking into this - you are correct. I don't care much about the % full. All I really was after was the "Is it overcapacity?" warning. I also think you figured out why it is miscalculating because the precision of the calculation with that large a number isn't specified. But it does work when expressed in gigabytes (see below). Sending you some wishes you get better whatever the problem.

Leo - yeah, 4.5 isn't really that close. I've burned enough "photo" DVDs and there you can fill up a DVD to a few megabytes precision. That's why I wanted it that exact. I know that the wikipedia number is almost always the max I can put on a standard DVD+R as usually I just check if it goes over 4,700,000,000 with right-click properties in explorer. If you have a thousand folders to burn to DVD, the DVD may max out slightly less but the burned folder info/metadata never seems to be more than a couple megs. Either way, DO is so much easier than explorer to check this info with the status bar.

Anyways, I figured out how to make it work correctly! I didn't know how else but with a methodical Trial and Error (lots of time).
These settings in the status bar work seem to work to the byte level. Selecting one byte over and the bargraph enables C3 properly:

DVD+R Single Layer - Capacity = 4,700,372,992 Bytes
bg+V=sbL/4.334221264g

DVD+R Dual Layer - Capacity = 8,547,991,552 Bytes
bg+v=sbL/7.882116337g

BluRay BD-R Single Layer - Capacity = 25,025,314,816 Bytes
bg+v=sbL/23.075881807g

This is definately the limit of the precision of the calculation. If one tries one more decimal place, the calculation doesn't work properly. But something is still strange about the calculate. Why the number for the calculation for DVD+R needs to be 4.334221264g instead of 4.3775634765 gb which is the correct value is not clear at all. Oh well - at least it works.

So if anyone cares about getting a more accurate representation of the bar graph capacity over limit for these particular media, try out the settings above.
Note: I'm quite sure the DVD+R and DVD+R DL capacities are very useful and accurate because I've used those figures for a long time.
But I haven't tested Wikipedia's BluRay Capacity listing. Hopefully it is just as accurate.

I'll be posting codes for my crazy looking status bar in the status bar thread soon.