CC snippet - Video length

Discuss and share scripts and script files...
highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: CC snippet - Video length

Post by highend »

why is it returning the 00:00:00
Because you put the full snippet into the script box of the custom column like I explained in my last posting...
Is there ANY way to change the default hotkey assignments in XYplorer
Menu - Tools - Customize Keyboard Shortcuts...?
One of my scripts helped you out? Please donate via Paypal

G_Mugford
Posts: 12
Joined: 22 Feb 2015 23:32

Re: CC snippet - Video length

Post by G_Mugford »

highend wrote: 28 Feb 2019 12:17 This is NOT the script, this is a snippet that fills all items for that custom column definition^^

This is the script:

Code: Select all

      $nsecs = property("System.Media.Duration", <cc_item>);
  
      // Use mediainfo for unknown codecs ($nsecs is empty!)
      if ($nsecs == "") {
          $mediaInfo = "<xydrive>\Tools\@Command Line Tools\MediaInfo\MediaInfo.exe";
          $length = regexreplace(runret("$mediaInfo --Inform=General;%Duration/String3% ""<cc_item>"""), "\.\d*\r?\n");
          return $length;
  
      // Use system properties for known codecs
      } else {
          // To get real seconds from nanoseconds, multiply the value with 0.0000001
          $secs = round($nsecs * 0.0000001);
  
          // Calculate length
          // Do we have a playtime in hours?
          $hours = $secs / 3600;
          if ($hours >= 1) {
              $hours = format(regexmatches($hours, "^\d+"), "00");
              $secs  = $secs - $hours * 3600;
          } else { $hours = "00"; }
          // Playtime only in minutes
          $mins = $secs / 60;
          if ($mins >= 1) {
              $mins = format(regexmatches($mins, "^\d+"), "00");
              $secs = $secs - $mins * 60;
          } else { $mins = "00"; }
          // -> Playtime is only seconds
          // Nothing to calculate here any more
          return $hours . ":" . $mins . ":" . format($secs, "00");
      }
And sorry, but this is total bs:

Code: Select all

$mediaInfo = "<xydrive>\Tools\@Command Line E:\apps\media\mediaInfo\CLI\MediaInfo.exe";
It must be:

Code: Select all

$mediaInfo = "E:\apps\media\mediaInfo\CLI\MediaInfo.exe";
I apologize for riling you up Highend. I copied the snippet as in the first response in this thread. Not knowing XYS scripting, I didn't know to excise the excess data in the snippet. As I just explained, what I did to the path for $mediaInfo LOOKED wrong to me, but I went with what I thought the replacement was supposed to be. My error, so sorry.

Having clipped the snippet correctly, I now have a working Video Length column. This is a mark for increased use of XYplorer. Which leaves me with a question: Am I stuck with this old 32 bit version of K-Lite? Can I install the latest version outside of the program files hive? It's not like the old version doesn't do the job. But I'm usually an instant updater for most programs for fear of a vulnerability sneaking by me.

Once again, thanks to EVERYBODY who took their time to help out a newbie. GM

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: CC snippet - Video length

Post by highend »

Would you please read the answers you get in this thread?
E.g.: viewtopic.php?p=167796#p167796
One of my scripts helped you out? Please donate via Paypal

G_Mugford
Posts: 12
Joined: 22 Feb 2015 23:32

Re: CC snippet - Video length

Post by G_Mugford »

highend wrote: 28 Feb 2019 12:36
why is it returning the 00:00:00
Because you put the full snippet into the script box of the custom column like I explained in my last posting...
Is there ANY way to change the default hotkey assignments in XYplorer
Menu - Tools - Customize Keyboard Shortcuts...?
The issue is handling mouse buttons. I toggle file selection with middle clicks. There are other mouse combinations that I can't get to. But that selection toggle is huge hurdle number one and the reason I mothballed XYplorer until doing my recent re-install of the latest versions of my software set. There's other differences in the way functions are handled for things, like Batch Renaming for one. But at least I can reassign the rename function to Alt-F2 and then do the batch rename to F2. That's counter to Windows standard, but it's the standard for the way I operate with file managers. Nice to know I can swap them around. I remember an issue the last time I looked. But I have no details, so it doesn't matter. Still, that mouse issue probably means scripting.

Something to do when the basketball game gets boring.

Thanks, GM

G_Mugford
Posts: 12
Joined: 22 Feb 2015 23:32

Re: CC snippet - Video length

Post by G_Mugford »

highend wrote: 28 Feb 2019 10:45 Em, what?

http://files2.codecguide.com/K-Lite_Cod ... 5_Mega.exe

This automatically installs 32 and 64-bit codecs (on a 64-bit OS), unless you
tell it specifically to leave out 32-bit ones...
Will read the page again when I'm less sleep deprived. I was supposed to be napping an hour ago. Thankfully, I stayed up and got the help I needed for the issue.

Sorry for making it all so arduous. Appreciate the willingness to stick it out. GM

insight
Posts: 30
Joined: 29 Apr 2020 10:44

Re: CC snippet - Video length

Post by insight »

highend wrote: 28 Feb 2019 12:45 Would you please read the answers you get in this thread?
E.g.: viewtopic.php?p=167796#p167796
Following on how to do this for myself. Thanks.

PS: IS it also possible to have XYP show Video & Audio codecs in extra columns?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: CC snippet - Video length

Post by highend »

You can show whatever mediainfo can extract and ofc it can do it for codecs
One of my scripts helped you out? Please donate via Paypal

Post Reply