Tuesday, August 05, 2008

Using Powershell to Query and Integrate MP3 Album Art

I've been trying to update my mp3 collection with album art since I got the P2. There are many tools out there that allow you to achieve this, but none that provide an easy and flexible way to automate the whole tagging process. That's why I wrote a quick and dirty Powershell script to do the job for me. Plus, it gives me a chance to play around with Powershell.

How it works:
The script can be executed in the following manner:
.\Mp3AlbumArt.ps1 .\mp3\*def*.mp3
or
.\Mp3AlbumArt.ps1 .\mp3\*\*.mp3
(recurse through sub folders)

The only parameter takes in the paths of the files that need to be processed. The script uses Greg Keogh's excellent NTag library for integrating the album art into the ID3 Tag. The album art itself is retrieved by querying the Amazon Web Service using the Artist and Album Tags. Obviously it doesn't work very well if the Meta tags are not set up properly.

Some assembly required:
You would need to register for an Amazon Web Service Account to get an key to query the service. Replace your key in the commented area to get stared.

Future:
I was in a rush to get something working so didn't spend too much time error handling or on any best practices. As I gain more experience with powershell, I will eventually re-write this script to take advantage of powershell functionality. But for now it serves is purpose.

References:

Download:

Comments and constructive criticism appreciated.

Sunday, August 03, 2008

The Microsoft Habu - 2000 dpi of gaming goodness

As most of you would know, I like to waste most of my free time gaming online. So it wouldn't come as a surprise that I've been hunting for the perfect business/gaming mouse for a while now. I was pretty excited when I finally got my hands on one of these babies. And what makes it sweeter is that I got it at real good price as well.

Like every other input device, its still taking me some time to get used to it. Its not an overly complicated mouse as far as gaming mice are concerned(this is a good thing). It feels solid and fills your hand pretty good (I still don't understand how and why some people use micro laptop mice). The on-the-fly dpi changer might come in handy. Haven't played any games with it yet, since I'm away from my main gaming rig at the moment, but I'm sure it would bump up my frags by a few kills at least :).

Get the Full Reviews and Specifications:

Debugging XSLT using Visual Studio 2005 / 2008

Visual Studio has the ability to debug XSL stylesheets. This a extremely useful feature that a few seem to know exist and use regularly.

Most of the projects I'm involved with use XSLT in one way or another. And the VS debugger along with other tools have saved me countless hours of frustration.

Here's a quick guide to get you started:

  1. Create / Open up the XSL file using Visual Studio
  2. Setup break points as necessary
    breakpoints
  3. Make sure that the XML Editor toolbar is visible
    XML Toolbar
  4. Click on the Debug XSLT button to start debugging
    debug_xsl
  5. A warning message would appear asking you to setup an input file. This would be the XML file that needs to be transformed. Click YES and select the input file.
    filename
  6. Step through the code.
    stepthrough

The only disadvantage or limitation rather is that you can't specify values for xsl:param variables. The workaround I use is to re-define the parameter as an xsl:variable , set the expected input value.

xsl_variable

On a related note, XslCompiledTransform class supports stepping into the stylesheet while debugging. The only pre-requisite is that the class should be instantiated with the debug parameter value set to true . Detailed instructions provided here.

Friday, August 01, 2008

New Site Column as a Managed Property

I was trying to create a Managed property from a newly created site column. What I didn't realize was that the column has to have content and crawled at least once (incremental/full, it doesn't matter) for it to be available in the "Crawled property Selection". It does makes sense if you think about it. So yeah.

More detailed information here.

Remember Kids, Google! is your friend.