Cave Markings
Alan Stevens attempts to make sense of life and technology
Find
Home
Archive
About
Resume
Contact
Tuesday, December 13, 2005
iTunes and Windows Media Player Play Nice
I've been playing with Home Theater PC software for a couple years. I settled on Windows Media Center Edition as my platform a few months back.
It isn't the best, but it is the easiest. It works out of the box, and has a great remote preconfigured. I got tired of fiddling, and wanted an appliance that just worked. MCE discourages fiddling, because it isn't as configurable as other packages.
The one drawback for me in using MCE is that all my personal CDs are ripped as iTunes AAC files. Actually, every HTPC front end I tried had this drawback, so it wasn't unique to MCE. Fortunately, MCE uses the media library from Windows Media Player. Getting WMP to play AAC files is a snap using the
3ivx
codec.
The trouble begins when you want to see tag info. You won't see any artist, album or track info after you add the files to WMP's library. In fact, you may find your AAC files in the "Other Media" ghetto... er, I mean node.
So here's the fix I worked out: Remove all AAC (.m4a) files from your WMP library. Apply the m4a.reg registry patch linked below. Add the AAC files into your WMP library. At this point you should be ready to run my little import app, but there's a caveat.
If your music is on a network drive, you need to be sure that it is added to iTunes using the UNC path. (e.g. \\computer\share) WMP will add the files mapped this way even if you have the share mapped to a local drive. Since I use the fully qualified file name as my means of relating the tracks in both libraries, this gave me some trouble.
The program (iTunes2WMP.exe) included in the .zip file below doesn't actually enable WMP to read the tags in AAC files. It reads the relevant information (artist, album, etc.) about a file out of the iTunes library, and then writes it into the WMP library. The result is the same as if WMP had read the tags directly.
I didn't set out to write a program to do this. I tried two utilities that I downloaded (from a forum that shall remain unnamed), and they both sucked. Not only did they not work for me, but the code was embarrassing to read. When I don't know what I'm doing, I try to copy someone who does. I can only assume that these people don't realize that they don't know what they are doing.
I wrote this utility in C# 2.0 because I wanted to try out some of the features of the new release. I can report that code snippets are a terrific productivity boost in Visual Studio 2005, but the real super-duper feature for 2.0 is generics. I created a strongly typed dictionary with one line of code, and I assure you that I did not know what I was doing when I started. It's just that easy. .NET generics are THE BOMB! "Stone guaranteed to blow your mind" as James Taylor would say.
If you use this utility, I'd like to hear your comments. I don't promise to make any improvements. That's why you have the source. I would just like to know if others find it useful.
++Alan
PS: The following files are provided without warranty, or assurance of fitness for any purpose. They could melt your synapses, give you bird flu or worse, crash your system. If they do, I'm not responsible. Got it?
iTunes2
WMP.zip (68.03 KB)
m4a.reg.txt (.66 KB)
Programming
|
Toys
Comments [5]
Sunday, January 01, 2006 7:41:02 PM (Eastern Standard Time, UTC-05:00)
Hi Alan
I am interested in your project here. I have no luck executing the itunes2wmp.exe. It always creates an error against your executable. What am I doing wrong?
Thane
Sunday, January 15, 2006 7:29:28 PM (Eastern Standard Time, UTC-05:00)
Thane,
Be sure you have the .NET 2.0 framework installed. It is available from Windows/Microsoft Update. If that isn't your problem, then post the error message, and I'll see what I can do.
++Alan
Alan
Thursday, January 26, 2006 9:28:00 AM (Eastern Standard Time, UTC-05:00)
You probably should include wmppia.dll from WMPSDK9\redist in your download or mention, that one should also download Windows Media Player 9 SDK and get wmppia.dll from there. Otherwise the program crashes with an unhandled file not found exception.
skibbi
Thursday, January 26, 2006 10:50:40 AM (Eastern Standard Time, UTC-05:00)
It seems, iTunesFile.Genre is null, if it is not set in iTunes, but null seems not to be a valid input for WMPTrack.setItemInfo("WM/Category" ...), so it would be better to do:
if (iTunesFile.Genre != null)
{
WMPTrack.setItemInfo("WM/Category", iTunesFile.Genre);
WMPTrack.setItemInfo("WM/Genre", iTunesFile.Genre);
}
Additionally WMPTrack.setItemInfo("WM/Year" ...) seems not to accept year 0, and besides 0 is a value one would probably not want to sync to WMP, thus:
if (iTunesFile.Year != 0) WMPTrack.setItemInfo("ReleaseDate", iTunesFile.Year.ToString());
and
if (iTunesFile.Year != 0) WMPTrack.setItemInfo("WM/Year", iTunesFile.Year.ToString());
Especially for classical music it would be very useful to have (for audio files):
if (iTunesFile.Composer != null) WMPTrack.setItemInfo("WM/Composer", iTunesFile.Composer);
One could also do WMPTrack.setItemInfo("UserRating", iTunesFile.Rating.ToString()), but doing a real sync so that changes in WM will be added to iTunes would be much better of course (and unfortunatly some more work, because you need to keep your own rating db to decide which values where changed).
skibbi
Tuesday, January 31, 2006 4:35:24 PM (Eastern Standard Time, UTC-05:00)
Skibbi,
Thanks for your detailed feedback. I've been doing some updates to address some of the shortcomings in the initial project. I'll incorporate your suggestions and post the revisions this weekend.
++Alan
++Alan
Comments are closed.
++Alan
Categories
My Life
My Soapbox
PoSh
Programming
TDD
Tools
Toys
User Group
VFP
VSTS
VSX
Flair
East Tennessee .NET Users Group
Twitter Updates
Blogroll
Alan Griver
Andrew MacNeill
Andrew Wulf
Andy Kramek
Bernard Bout
Beth Massi
Bo Durban
Calvin Hsia
Cesar Chalom
Chris Sells
Christof Wollenhaupt
Craig Bailey
Craig Bernston
Craig Boyd
Dare Obasanjo
Dave Laribee
Deepankar Dubey
Don Box
Don Demsak
Doug Hennig
Doug Turnure
Drew Robbins
Dustim Campbell
Eric Lippert
Eric Sink
Ian Cooper
Jacob Proffitt
James Lau
James Manning
Jean-Paul S. Boodhoo
Jeff Atwood
Jeff Prosise
Jeffrey Blankenburg
Jeffrey Palermo
Jeremy Miller
Jim Wooley
Joel Spolsky
John Koziol
John Lam
Jon Box
Jon Box
Jon Galloway
Josh Holmes
Julie Lehrman
Keith Elder
Ken Levy
Kevin Barnes
Kevin Cully
Kevin Ragsdale
Leon Bambrick
Lidor Wyssocky
Martin Fowler
Michael Lopp
Michael Neel
Mike Arace
Noah Coad
Pablo Galiano
Patrick Cauldwell
Paul Yuknewicz
Phillip Haack
Rick Borup
Rick Schummer
Rick Strahl
Rob Foster
Rockford Lhotka
Sam Gentile
Scott Bellware
Scott Guthrie
Scott Hanselman
Simon Guest
Steve Bodnar
Steve McConnell
Steve Yegge
Steven Smith
Ted Neward
Tim Anderson
Tod McKenna
Todd Hoff
VSX Team
Wallace B. McClure
Wesner Moise
Sign In