I have a large Plex library that I rip my own BluRay movies to, and I've been playing around with various video ripping and encoding software. I often get files that visually seem pretty much identical, but have varying file sizes. sometimes I include different audio tracks, different subtitle languages, and other stuff, but I am also trying to keep the library from using as much hard drive as possible. Every little bit counts!
Is there a quick way in Directory Opus to calculate the size difference between 2 files?
dang, I don't know how to write code to do all that . Maybe I'll just keep a Google page open all the time and hand type the math into it as needed. Thanks!
It sounds easy enough, and I could probably use it myself. Give me a lil bit and I'll see what I can whip up for ya.
Here ya go. Wrote up some VBScript to do it in a menu item. You just select the 2 files to compare, right-click, choose it from the menu and it'll get the 2 file sizes, then launch your default web browser to let Google do the rest.
It'll automatically check to make sure that 2 (and only 2) files are selected before it does anything, and will only show up for files (not folders, though you could probably do that too if ya want, with just a tweak to the code).
Here's how to "install" it:
In Directory Opus, go to Settings | File Types ...
Double-click on "(NONE) All Files"
Click on the Context Menu tab
Click the "New ..." button
On the "Action" line, type in "Calculate Filesize Difference" (or whatever you want to label it as), and choose an icon for it too if ya want, by clicking the button to it's right
Under "Function", select "Script Function"
Then, in the box, paste this code:
@disablenosel @script vbscript ' ------------------------------------------------------------------------------------------------------ ' ' Filesize Difference Calculator - J. Scott Elblein | GeekDrop.com | http://about.me/scott.elblein ' ' Purpose: ' Allows selecting 2 files, and finding out the size difference between the two. Useful for example, ' when working with large movie files, to quickly compare how much space you may save by keeping one ' movie file instead of the other, without having to manually "think" for yourself.' ' ------------------------------------------------------------------------------------------------------- ' We don't want to do anything unless *exactly* 2 files are selected ... If DOpus.Listers.LastActive().ActiveTab.selstats.selfiles = 2 Then ' We need a URL Encode function apparently? Function URLEncode(StringToEncode, UsePlusRatherThanHexForSpace) Dim TempAns, CurChr, iChar CurChr = 1 Do Until CurChr - 1 = Len(StringToEncode) iChar = Asc(Mid(StringToEncode, CurChr, 1)) If (iChar > 47 And iChar < 58) Or (iChar > 64 And iChar < 91) Or (iChar > 96 And iChar < 123) Then TempAns = TempAns & Mid(StringToEncode, CurChr, 1) ElseIf iChar = 32 Then If UsePlusRatherThanHexForSpace Then TempAns = TempAns & "+" Else TempAns = TempAns & "%" & Hex(32) End If Else TempAns = TempAns & "%" & Right("00" & Hex(Asc(Mid(StringToEncode, CurChr, 1))), 2) End If CurChr = CurChr + 1 Loop URLEncode = TempAns End Function ' Create vars to store file sizes, and encoded URL Dim fileSizeA, fileSizeB, sURL ' Grab the file sizes in bytes fileSizeA = DOpus.Listers.LastActive().ActiveTab.selected_files(0).size ' Bytes fileSizeB = DOpus.Listers.LastActive().ActiveTab.selected_files(1).size ' Bytes ' Compare the sizes in bytes first; so we put the bigger number first ' NOTE: Need to Convert to Double to be certain of a correct comparison If CDbl(fileSizeB) > CDbl(fileSizeA) Then ' Retrieve the 2 file sizes, formated as KB/MB/GB/Etc. (Reversed, since the 2nd file is larger) fileSizeA = DOpus.Listers.LastActive().ActiveTab.selected_files(1).size.fmt ' Pretty fileSizeB = DOpus.Listers.LastActive().ActiveTab.selected_files(0).size.fmt ' Pretty Else ' Retrieve the 2 file sizes, formated as KB/MB/GB/Etc. fileSizeA = DOpus.Listers.LastActive().ActiveTab.selected_files(0).size.fmt ' Pretty fileSizeB = DOpus.Listers.LastActive().ActiveTab.selected_files(1).size.fmt ' Pretty End If ' Encode the URL sURL = "https://www.google.com/search?q=" & URLEncode(fileSizeA & " - " & fileSizeB, False) ' Launch the default web browser, and let Google handle all the dirty work for us CreateObject("WScript.Shell").Run(sURL) Else DOpus.output "Wrong number of files selected for calculating filesize difference; aborting." End If
Click all the "OK" and "Close" buttons, select the 2 files to compare, right-click, and you'll see this new menu item:
Click it, and you'll get this:
Olympus
Single & Not Looking
Hmmm, well, I can't think of a built-in Directory Opus function to do this, but you can create your own using something like jscript or vbscript. Might even be nicer to skip writing out more code than necessary, and just select your 2 files, and pass it to Google as a search. Then Google will do the calculation and "pretty" formatting / conversions for ya too.