Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. # Needs the path where your dll is
  2. Add-Type -Path "C:\taglib-sharp.dll"
  3.  
  4. Function Get-VideoDetails {
  5. param ($targetDirectory)
  6.  
  7. Get-ChildItem $targetDirectory -Include *.mp4 -Recurse -Force | ForEach {
  8. $video = [TagLib.File]::Create($_.FullName)
  9.  
  10. New-Object PSObject -Property @{
  11. Name = $_.FullName
  12. Duration = $video.Properties.Duration.TotalMinutes
  13. }
  14. }
  15. }
  16.  
  17. # Supply your video directory
  18. Get-VideoDetails "C:\Users\Wesam\Documents\MEGA\EggHead\Courses" | Sort Duration -Descending | Group-Object Item | %{
  19. New-Object psobject -Property @{
  20. Item = $_.Name
  21. Sum = ($_.Group | Measure-Object Duration -Sum).Sum
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement