User Login

Help Community Login:

Directory Opus Help? Want to create menu item to calculate 2 file size differences.

4 replies [Last post]
Phantom's picture
From:
NY
Phantom
Premium Member (Silver)I use FirefoxWindows UserI donated to GeekDrop simply because I love it!I'm MagicThe Dr. put the stem on the apple!Someone thinks you're a Rotten Tomato!
Relationship Status:
In an Open Relationship
Joined: 06/13/2010
Posts: 38
Drops: 74
Mood: Dark

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! Smile

Is there a quick way in Directory Opus to calculate the size difference between 2 files?

I Averaged: 4 | 1 vote


Read More ...





Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
STaRDoGG's picture
From:
Olympus
STaRDoGG
Head Mucky MuckJoined the Dark SidePremium Member (Gold)I'm a Code Monkey!The Steel CurtainI use FirefoxI use Google ChromeI use Internet ExplorerI use SafariLinux UserMac UserWindows UserI donated to GeekDrop simply because I love it!Booga Booga BoogaI took a bite of the AppleFormer Phrozen Crew MemberI'm MagicMember of VileThe Dr. put the stem on the apple!The JokerSomeone thinks you're udderly delightful!
Relationship Status:
Divorced
Joined: 01/14/2009
Posts: 2556
Drops: 3007
Mood: Curious
Re: Directory Opus Help? Want to create menu item to ...

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. Thumbs Up



Shhh.. dont tell anyone, but we also have a private forum area with the really good stuff, see?

Phantom's picture
From:
NY
Phantom
Premium Member (Silver)I use FirefoxWindows UserI donated to GeekDrop simply because I love it!I'm MagicThe Dr. put the stem on the apple!Someone thinks you're a Rotten Tomato!
Relationship Status:
In an Open Relationship
Joined: 06/13/2010
Posts: 38
Drops: 74
Mood: Dark
Re: Directory Opus Help? Want to create menu item to ...

dang, I don't know how to write code to do all that Laughing. Maybe I'll just keep a Google page open all the time and hand type the math into it as needed. Thanks!

STaRDoGG's picture
From:
Olympus
STaRDoGG
Head Mucky MuckJoined the Dark SidePremium Member (Gold)I'm a Code Monkey!The Steel CurtainI use FirefoxI use Google ChromeI use Internet ExplorerI use SafariLinux UserMac UserWindows UserI donated to GeekDrop simply because I love it!Booga Booga BoogaI took a bite of the AppleFormer Phrozen Crew MemberI'm MagicMember of VileThe Dr. put the stem on the apple!The JokerSomeone thinks you're udderly delightful!
Relationship Status:
Divorced
Joined: 01/14/2009
Posts: 2556
Drops: 3007
Mood: Curious
Re: Directory Opus Help? Want to create menu item to ...

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.



Shhh.. dont tell anyone, but we also have a private forum area with the really good stuff, see?

STaRDoGG's picture
From:
Olympus
STaRDoGG
Head Mucky MuckJoined the Dark SidePremium Member (Gold)I'm a Code Monkey!The Steel CurtainI use FirefoxI use Google ChromeI use Internet ExplorerI use SafariLinux UserMac UserWindows UserI donated to GeekDrop simply because I love it!Booga Booga BoogaI took a bite of the AppleFormer Phrozen Crew MemberI'm MagicMember of VileThe Dr. put the stem on the apple!The JokerSomeone thinks you're udderly delightful!
Relationship Status:
Divorced
Joined: 01/14/2009
Posts: 2556
Drops: 3007
Mood: Curious
Re: Directory Opus Help? Want to create menu item to ...

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:

  1. In Directory Opus, go to Settings | File Types ...

  2. Double-click on "(NONE) All Files"

  3. Click on the Context Menu tab

  4. Click the "New ..." button

  5. 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

  6. Under "Function", select "Script Function"

  7. 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. Tongue
'
' -------------------------------------------------------------------------------------------------------

' 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:

 
Directory Opus Compare Filesize Difference Menu Item

Click it, and you'll get this: Call Me

Directory Opus Compare Filesize Difference Script

Who's New

davidclay123's picture
Sunny's picture
ZDooX's picture
Miamihot2007's picture
Fred McBen's picture
Sri's picture
bammer's picture
akay's picture
r1sc's picture
hakimo's picture
Tanpro's picture
Edualc31's picture
Dareyeww's picture
Tomel's picture
kik's picture
facebook codes exploits tips tricks Phrozen Crew
All contents ©Copyright GeekDrop 2009-2017
TOS | Privacy Policy