Music Library Cleaning with PowerShell – Identifying Old MP3 Files with Low Bitrates

cleanup

Over the past couple of years I travel quite a lot.  As such, I tend to load up on digital format. However, some of my older files have some nasty names or bad quality.

This has led to me to start grooming my 15,000+ song catalog.  That number does not include another 15,000+ audio book files.  I love to listen to books while running.

As I was going through the folders of CD rips, iTunes purchases, and other sundry file droppings… I was feeling a bit overwhelmed.

Trying to scope the issue I went for the following categories

  • ITunes Music
  • Files below a certain Bitrate Threshold
  • Artists I did not enjoy
  • CD Tagging

Today I am going to talk about how I used PowerShell to identify files below a certain bitrate threshold.   Example, I want to get all MP3 files with a bit rate less than or equal to 100.  Then I want to delete them… as they sound even worse on digital players (like the iPhone)

  1. Run the PowerShell Function Get-Mp3FilesLessThan with up to three inputs
    1. Inputs
      1. Directory
      2. BitRate
      3. File Extension
    2. Example
      1. Get-Mp3FilesLessThan \\Server\Music 100 *.mp3 | Format-Wide
    3. Output
      1. List of all files where criteria are matched
  2. Delete result site
    1. Get-Mp3FilesLessThan \\Server\Music100 *.mp3 | Remove-Item -WhatIf
      1. I like using –WhatIf because Remove-Item by default does not show results
      2. Remove the –WhatIf to commit the change

Enjoy!

function Get-Mp3FilesLessThan( [string]$directory = "$pwd", [int]$minimumBitrate = 32, [string]$FileTypeExt = "*.mp3" ) {
  $shellObject = New-Object -ComObject Shell.Application
  $bitrateAttribute = 0

  # Find all mp3 files under the given directory
  $mp3Files = Get-ChildItem $directory -recurse -filter $FileTypeExt
  foreach( $file in $mp3Files ) {
    # Get a shell object to retrieve file metadata.
    $directoryObject = $shellObject.NameSpace( $file.Directory.FullName )
    $fileObject = $directoryObject.ParseName( $file.Name )

    # Find the index of the bit rate attribute, if necessary.
    for( $index = 5; -not $bitrateAttribute; ++$index ) {
      $name = $directoryObject.GetDetailsOf( $directoryObject.Items, $index )
      if( $name -eq 'Bit rate' ) { $bitrateAttribute = $index }
    }

    # Get the bit rate of the file.
    $bitrateString = $directoryObject.GetDetailsOf( $fileObject, $bitrateAttribute )
    if( $bitrateString -match '\d+' ) { [int]$bitrate = $matches[0] }
    else { $bitrate = -1 }

    # If the file has less than or equal to the desired bit rate, include it in the results.
    if( $bitrate -le $minimumBitrate ) { $file }
  }
}
Advertisements

MyITForum: Then of an era

I have been an avid user, contributor, speaker, and blogger on www.myitforum.com since 2005.  It has been an amazing journey.  However with the most current owners a lot of great content is disappearing.  As such I am attempting to grab content before it disappears completely.

The email lists are by far the best part still.

As such sorry for all the ancient posts coming over in the next few days.

http://myitforum.com/myitforumwp/author/scassells/

 

Google: Local Guides level 5 – You’re a Local Guides pro

Level 5: 500+ Points

As a Level 5 Local Guide, you can:

Get access to test new Google products before public release
Apply to attend our Level 5 Local Guides summit

 

This is the highest level you can currently achieve with Google Local Guides.  Other levels have nice Benefits.  Like 1TB of Google Drive storage.  I travel a lot for work and I tried to writing on a lot of different sites like Travelzoo, yelp, etc.  I fixated on maps.google.com mainly because it is ubiquitous and fairly easy to add info.  I hope you enjoy one of my piratical posts on any of the several hundred locations.

 

 

Resolved: Microsoft Office 2010 Copy and Paste Stopped Keeping Source Formatting if Skype Click to Call is Installed

Written in 2011 – http://myitforum.com/myitforumwp/2012/06/19/resolved-microsoft-office-copy-and-paste-stopped-keeping-source-formatting-if-skype-click-to-call-is-installed/

 

I noticed recently that my copy and paste in Microsoft Office 2010 stopped keeping the source formatting.  It was only allowing the paste of text only.  If you were to check for paste special it would show only a capital A.

I noticed that if you closed all internet browsers except Firefox the issue would resolve.

Turns out SKYPE Click to Call Plug in is causing the issue

Uninstall SKYPE Click to Call.

Everything works well again!

Marriott and SPG: Better together if you have Status

As of September 2016 Marriott purchased SPG.  If you have status  with any of the following (high enough) then you have status at them all!

  • Marriott
  • SPG
  • Delta
  • United

Marriott Platinum or SPG Platinum gives you the other. http://Members.marriott.com

Marriott Platinum Status gives you United Silver – https://mrrewardsplus.com

United Mileage Plus Gold or Higher Gives you Marriott Gold – https://secure.unitedmileageplus.com/reg/rewards_plus/index.htm

SPG Platinum gives you Delta Silver –https://www.starwoodhotels.com/preferredguest/account/benefits/delta/confirm.html

Delta  Diamond or Platinum Medallion  gives you SPG status – https://www.delta.com/profile/spgLanding.action

Uber gives you SPG points – https://www.spgpromos.com/uber/?EM=VTY_SPG_UBER_PROMOTION?iataNumber=33707800&wps=96635464&siteID=76t2eiQKcUU-gphD_XQGfwK95PBXt1sp4A

Basically it is a very good day for domestic travel.

Windows 10 FIX: WebEx does not support IE 11 or Edge

Looks like WebEx does not yet work with Edge nor IE11 in Windows 10.  WebEx only says it should work.  Yet some people have issues.  The follow is the workaround

WebEx says not Supported https://support.webex.com/MyAccountWeb/knowledgeBase.do?articleId=WBX87246

Issue

W10 WebEx IE11 Error

Fixes

Chrome

Use the Extension IETab

IE11

  1. F12 (Developer Tools)
  2. Emulation Tab
  3. Change “user agent string” to “Internet Explorer 10″
W10 WebEx IE11 work around
W10 WebEx IE11 work around

Edge

  1. F12 (Developer Tools)
  2. Emulation Tab
  3. Change “user agent string” to “Internet Explorer 10″
W10 WebEx EDGE work around
W10 WebEx EDGE work around

Windows 10 Event 10016 Fix: The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {D63B10C5-BB46-4990-A94F-E40B9D520160} and APPID {9CA88EE3-ACB7-47C8-AFC4-AB702511C276} to the user NT AUTHORITY\LOCAL SERVICE SID (S-1-5-19) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.I a

Ran into a lot of DCOM (DistributedCOM) errors on Windows 10 machines after upgrades.  Looks like the TrustedInstaller from a previous application and the RunTime Broker did not give System and Local Administrators permission during a Windows 10 upgrade.  It just an annoying thing but also slows down a windows 10 Login.

The Error

The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID 
{D63B10C5-BB46-4990-A94F-E40B9D520160}
 and APPID 
{9CA88EE3-ACB7-47C8-AFC4-AB702511C276}
 to the user NT AUTHORITY\LOCAL SERVICE SID (S-1-5-19) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.

Background

It would appear that an Apple application was installed on these machines at some point and that it did not do a proper install.  The W10 upgrade exacerbated the issue due to missing security accounts after a W10 upgrade.  The fix is to give local administrators and System rights to the DCOM.  To do this you have to modify premissions on two registry keys and then change the DCOM premissions.  Pretty easy to do.

FIX

Regedit Take Ownership

You will need to take ownership then set rights against two different keys.  The keys are:

HKEY_CLASSES_ROOT\AppID\{9CA88EE3-ACB7-47c8-AFC4-AB702511C276}
HKEY_CLASSES_ROOT\CLSID\{D63B10C5-BB46-4990-A94F-E40B9D520160}
  1. Open Regedit with Administrators privileges and navigate to the keys above (remember you have to do this twice)
    1. WinKey + X >> Command Prompt (Admin) >> Type in Regedit
  2. Right click the key >> permissions
  3. Click advanced
  4. At the top change the Owner to COMPUTERNAME\Administrators
    1. Please note if you are domain joined you’ll have to change where you are searching from to your local computer
  5. Look in the Permission Entries field
    1. If the local system administrators group is listed ensure it has full control
    2. if the administrators group is not listed add it and give it full control.  (note you can only do this if you are a member of the administrators group and it is now the owner)
  6. Click okay a lot >> Ensure you apply permissions to all child objects

Change DCOM Permissions

Need to ensure DCOM permissions are setup

  1. Open DCOMCNFG as an Administrator
    1. WinKey + X >> Command Prompt (Admin) >> Type in DCOMCNFG
  2. Navigate to Component Services >> Computers >> My Computer >> DCOM Config
  3. Find the RunTimeBroker  >> Right Click >> Properties >> Security Tab
  4. Launch and Activation Permissions >> Edit >> Add System and give it full control
    1. I also added the Administrators group just for testing

While changing permissions I was prompted several times to remove bad account references.  I did this as the computer knows which accounts have been removed.

Summary

At this point you should have sorted the DCOM errors.  Give your computer a reboot and away you can go.