September 2008 Blog Posts

Overview of My Media Center Solution

Now that I've solved my media center problem, let me do a review of what I was trying to do, what I did, and some of the lessons learned along the way.

Goals of my media center solution:

  1. Access to my DVD collection. I have a lot of DVDs and, yes, I do like to re-watch them. The problem I'm running into is the same problem I ran into with my music collection - inconvenient access. I think about a movie I want to watch, then I have to go through the collection, find it, fire up the system... it's a lot less "at my fingertips" than I'd like. It's also nearly impossible to browse, so if I want to look for something to watch, I have to either riffle through the binders of discs, use an outdated printout list of movies, or fire up DVD Profiler and scan through there.
  2. Backup solution. My dad and I both have had DVDs go bad. Ideally I'd like to be able to re-burn a disc if I have the original go bad.
  3. Full quality, all features. I want to be able to navigate and view the DVD as if I had put it into a DVD player - full menus, no reduced quality, all audio tracks, all extra features.
  4. Wife acceptance factor. I want it to be easy and accessible to Jenn so she can use it, too, without having to memorize the 37-button-sequence to get it working.
  5. Network storage. I want everything to be stored centrally so the data can be accessed by any device.

Secondary goals:

  1. Simple, simple, simple. As few "moving pieces" as possible. I know there are ways to get very fancy setups going if you want to invest the time and effort in tweaking, perfecting, and messing about with the system. I'm not a hobbyist, and investing that level of time doesn't interest me. I want to set it up and have it "just work" in as much an appliance fashion as possible.
  2. Expandable. If I need to add storage, add another media front-end, etc., I want the flexibility to do that.
  3. Good form factor. I don't want something ridiculously ostentatious sitting in the living room. I want it to look good.
  4. Music and picture access. DVDs are my primary goal, but if I can get access to my music and pictures through the system, so much the better.

What I settled on:

  • Storage - Two Separate Systems:
    • Windows Home Server. For music, home movies, photos, and documents I went with a Windows Home Server as the central storage mechanism. It gave me some great first impressions and I learned a lot even two weeks in, but I've never looked back. WHS got a bad rap early on with some data corruption defects that have been fixed and I think people really need to give it a chance. It has a great form factor, is totally expandable, and has all of the DLNA sharing pre-configured for easy access to music, pictures, and videos for compatible devices. It plugs in and "just works," appliance-style, and even provides additional features like monitoring your network health and backing up your PCs. Dollar for dollar, I'd take this over a generic NAS any day. (That said, there are some recommended upgrades you might want to do to make the most of your server.) UPDATE: I originally used Windows Home Server as the single storage solution, but ended up adding the Synology NAS and switching the DVD images to that.
    • Synology NAS. I went with the Synology DS1010+ for movie storage. I did this because I ran into some odd disk-related issues with the home server (bad drives) and since I didn't have enough disk space to turn on duplication for my DVD images, I wanted to figure out some sort of fault tolerance if a drive went out. The DS1010+ will let me run RAID 5 and is super fast, so I moved to that for the DVDs.
  • Front-End Software - Windows 7 Media Center and XBMC. I looked at MediaPortal, TVersity, Front Row, Xbox Media Center, just using the Xbox 360 as a media extender, and several other front-end software packages, but Windows Media Center initially won out for several reasons. First, it comes bundled with the OS - fewer moving pieces (unlike an additional application you'd have to install, e.g., TVersity). Second, it's handled VIDEO_TS DVD rips for quite some time (unlike Front Row, which only just recently got it and has no real documentation out there available for it). Third, it handles almost all of the other formats I use for pictures, music, etc. (unlike Xbox 360 as a media extender, which doesn't support full DVD rips).
    • UPDATE 12/14/09: I updated to Windows 7 from Windows Vista and it made a lot of difference in performance - smoother playback, faster loading of the DVD Library, etc.
    • UPDATE 12/29/11: I have just started using XBMC as the front end instead of Windows Media Center because the rendering of the DVD library is much faster than Windows Media Center, especially with a lot of movies. It also has a much nicer UI with art and info than the more sparse WMC UI.
  • Video Format - VIDEO_TS. I blogged about the pros and cons of various video formats, and in the end I picked VIDEO_TS as the format I'd rip my DVDs into since it was most compatible with the various software packages and didn't require any additional tweaking in Media Center to use. Plus, it gives full access to the disc features (menus, etc.), you don't lose any quality, and you can re-burn VIDEO_TS to a DVD and have a watchable disc just like the original.
  • Front-End Hardware - Dell Studio Hybrid PC. I picked up a Dell Studio Hybrid PC to be the hardware sitting in my living room. It has a great form factor and all the right connections (DVI, HDMI, S/PDIF audio) to make it a perfect media center PC. I had considered getting a Mac Mini, as several other folks have done, and run Boot Camp to boot into Vista, but the Studio Hybrid was far cheaper and more powerful than the top-end Mac Mini.

How it works:

I set up the "DVD Library" in Windows Media Center rather than using the popular My Movies plugin because, again, I really wanted as few "moving pieces" as possible and My Movies didn't seem to offer me anything I truly needed. If, at some later time, I want to start using it, I haven't engineered myself out of it - I can install it and import the movies that already exist with a minimal amount of work.

I rip my DVD movies onto the Synology DS1010+. The Dell Studio Hybrid PC, which is connected to the TV in my living room, reads the list of movies from the NAS over the network and displays them beautifully on the TV for me to select from. I was running this nicely over wireless, but started running into interference issues, so it's now a wired network.

My photos are accessible through not only the Windows Media Center, but also through my Xbox 360 and PS3 via the DLNA sharing that comes for free out-of-the-box with my Windows Home Server.

My music is accessible to DLNA compliant devices (Xbox 360, PS3) through Asset UPnP on the Windows Home Server. Windows Media Center doesn't natively play Apple Lossless (though with Windows 7 it does play AAC) so I don't have it running through the Media Center.

Diagram:

Here's a picture of the current network topology, with a little added detail around how things connect to my TV. It's pretty simple, not a lot of moving pieces, and the majority of things are wireless. As much as possible is also connected directly to the network (like my printer) so I can access anything from anywhere.

Media center and network layout.

Lessons learned:

  • Everything in Home Theater PC-land is tribal knowledge. It took the majority of my time to figure all of this out because there are far too many options with far too few people providing information in accessible locations. Most information on this stuff lives in forums, making it hard to pick through and figure out what's going on. When you ask questions, people assume you already know a bunch of stuff you don't know, so you get very cryptic answers, which you then have to go research and ask more questions about.
  • Format wars are a pain. I'm specifically looking at you, WMA vs. AAC. There's no good reason I can find that the Apple formats aren't supported out of the box by Media Center other than the desire to remain proprietary. Garbage. (With Windows 7, AAC is supported but Apple Lossless still isn't.)
  • Even in a simple environment, things are fiddly. Getting everything stored centrally, updated properly, displaying right, with correct access... it's trivial, annoying, fiddly stuff. Tweak this registry setting, add a symbolic link to this folder, map this drive, configure this setting... it's a pain, and if you don't get it right, things don't work as smoothly as you'd like.

Next steps:

So, now that it's done - two years in the making - what am I going to do next?

  • Music access: I'm looking at MCETunes to enable access to my iTunes content in Media Center.
    [UPDATE: I found you can get Media Center playing iTunes files natively by adding some codecs and metadata tag parser support. I also found you can use Windows Home Server add-ins to stream music to Xbox 360 and PS3 that wouldn't normally work.]
    [UPDATE 2: I'm using Asset UPnP for DLNA streaming/transcoding of Apple Lossless, etc., to Xbox 360 and other DLNA compatible devices.]
  • Front-end upstairs: I have a spare desktop (the ThinkCentre) that I may put upstairs so we can access the same DVD content in another room. It's not as nice of a form factor, but that's less concerning in the game room.
    [UPDATE: I did end up moving that ThinkCentre upstairs and it's working well.]
  • Finish ripping movies: I have 90 movies on the server right now, but 500+ titles. I've gotta get these things ripped. I won't rip every single one of them, and probably won't rip the "extended features" discs, but that's still a lot of work left to do.
    [UPDATE: I finished ripping all of my movie discs - no extra features discs - and have 770 VIDEO_TS folders taking up 4.91TB of space on the Windows Home Server. That's about 6.7GB per image.]
  • Upgrade my MPEG2 codec: The built-in DVD player for Media Center is notoriously mediocre. It looks decent enough, but by upgrading your MPEG2 codec (and configuring Media Center to use it) you can get better playback quality. A lot of folks swear by the NVidia codec which you can buy separately or get with PowerDVD. [UPDATE:: XBMC uses FFmpeg to play DVDs and I've had some better luck with XBMC as the front end. Some discs that looked exceptionally bad... still don't look awesome, but are at least better.]
  • Fix the video resolution: The TV in the living room is a native 1366 x 768 resolution. The closest the Dell Studio Hybrid gets to that is 1280 x 768, which looks crisp but leaves a bit of a black letterbox on either side of the picture. I'd like to get it to display full-screen, but it looks like it involves some very fiddly stuff and a tool called DTDCalc. [UPDATE: Connecting the PC through HDMI to a newer TV yielded full 1080p resolution with no letterboxing.] [UPDATE 2: I upgraded the TV in the living room to a 1920 x 1080 set and still have no problems.]

Related posts:

I've done a lot of work to get this far, so there are quite a few related posts I've made that may be of interest. (Most of these, and more, are linked in the above article, but for your convenience, here are some highlights.)

Dell Studio Hybrid Media Center Installed

I had the Windows Media Center DVD Library set up, I upgraded my Windows Home Server to have capacity to store my movies, so the last step was to get a home theater PC in the living room so I could play the DVD images off the network. (This is all part of my overall media center solution.)

Dell Studio Hybrid Media Center PC - sits right next to my Xbox 360.
The Dell Studio Hybrid is the little black box under the Xbox 360 HD DVD drive. [From Studio Hybrid Media Center]

After some research and pricing, I ended up getting a Dell Studio Hybrid PC from Best Buy. Dollar for dollar, I got more horsepower than if I had gone with a Mac Mini, and I didn't have to get a separate Windows Vista license. It came with Vista Home Premium (which includes Media Center), a dual core 2.1GHz processor, 3GB RAM, wireless-N built-in, DVI and HDMI output... basically, it was set to go as a Media Center, and it was $50 less than the better of the two currently offered Mac Mini models.

Installation was a snap. There were (obviously) a few fiddly things to deal with like setting up the media center user account, connecting it to my Windows Home Server for backup, setting up Windows Media Center to find all of my media... but really no major hiccups. The Windows Media Center setup wizards are fantastic and really get you going in great shape quickly.

There are only a couple of things I need to deal with, neither of which are showstoppers so much as generally annoying.

  1. Monitor resolution. When you've got a home theater PC, your TV is effectively your monitor. Unfortunately, my TV only supports a certain number of resolutions, only a few of which are also supported by the out-of-the-box video card and drivers that came with the PC. To that end, I have things displaying at 1280 x 768, which is nice and crisp (and supported on my TV) but leaves a bit of a black letterbox on the right and left sides of the screen since the full resolution of the TV is 1366 x 768. I may look into an application like PowerStrip to see if I can tweak the card into displaying a full resolution, but then, the half-inch letterbox on either side of the screen really isn't killing us, either.

    UPDATE: Several forums report PowerStrip doesn't work with Intel integrated graphics cards, which the Hybrid has. There is a tool called DTDCalc that is supposed to do some craziness to get things to work, but it looks pretty hacky to me (or at least it doesn't abstract me away from the hackiness much) and involves knowing about VESA standard timings and such. Yow. Anyway, for those bold enough to take that leap, there it is.

    UPDATE 2: I tested out connecting the Hybrid to the TV using an HDMI cable rather than the DVI cable I was using. When doing that, I had several new resolution options to choose from including 1920x1080i. My TV didn't really "like" that resolution and didn't display it properly (things stretched off the screen and flickered really bad) but the experiment proved out - the information coming in from the TV is what tells the PC the resolutions it supports. It's an older TV and I'm planning on getting an upgrade soon, so hopefully the new TV will better support the signal.

    UPDATE 3: I got a Samsung LN52A750, hooked the PC up via HDMI, and instantly got full 1080p high-def output. No tweak required. No letterboxing along the sides. Everything looks brilliant. Whew!
  2. Remote control IR frequency conflict. The Media Center remote control and IR receiver that I bought, which is a nice yet inexpensive unit, happens to use the exact same infrared frequency as the Xbox 360 so when you turn on/off the PC with the control, it also turns on/off the Xbox 360. Since I rarely use the Xbox 360 remote (only when watching HD DVDs) I'll probably find some sort of temporary cover for the IR receiver port on the 360 so I can cover/uncover it as needed.
  3. Windows Home Server backup and machine sleep. When you "turn the PC off" with the remote, you're really putting it to sleep. When Windows Home Server connects to the PC to back it up, it wakes the PC up. Unfortunately, it isn't going back to sleep after that. I need to work on the power settings so it goes back to sleep when it's done backing up.

    UPDATE: I fixed this by changing the sleep time to a lower number (10 minutes) and switching the screen saver to one of the simpler ones like "Windows Logo."

    UPDATE 2: I had some issues getting the HDMI signal to come back if I put the PC to sleep while the TV was off. It looks like getting a little HDMI switchbox fixes that.

I'll put together a network diagram soon so folks can see how the whole system came together. I've been looking at solutions to my media center problem for almost two years to the date, so it's nice to finally have it solved.

Home Server Upgrades

I took the plunge today and decided to do a little upgrading on my Windows Home Server. I was already going to have to add some drives, and found so many people out there who noted that a RAM upgrade was a massive improvement, I decided to do both - add RAM and drives.

The first, and trickiest, upgrade, was the RAM. I got a Corsair DDR2 667MHz 2GB stick from Fry's. Then, following this guide, I disassembled the server, swapped out the RAM, and put it all back together. (There are a few Home Server RAM upgrade guides out there, but the one I used from Home Server Hacks seemed to be the most detailed and helpful.)

The RAM upgrade was a little fiddly, having to take so much apart to get to the RAM, and I'm not afraid to say I started sweating a little when it booted up and the "health" light on the front of it turned red for several seconds (presumably as it realized there was more RAM and adjusted things). After that, though, I was able to log in and see the upgrade had taken effect:

Home Server RAM upgrade - the readout shows 1.97GB now.

I also adjusted my pagefile size (there's a guide for that, too).

The difference? I don't have many add-ins running (just the standard stuff that came on the server and the KeepVault backup add-in), but even the basic Home Server Console comes up noticeably faster. Before the upgrade, the console took maybe 10 - 15 seconds to come up. Now it takes maybe three seconds. Definitely an upgrade that was well worth doing.

I also bought two 1TB Western Digital Caviar GreenPower drives to put in. Admittedly, the "green" aspect of the drives is nice, but the simple fact is that they were on sale for $155 each at Fry's (limit one per customer, so I had Jenn buy one) and I didn't have to take my chances with NewEgg's shoddy OEM drive packaging... plus, since it's a retail package, I get the full retail warranty.

Adding a drive to the Home Server is the easiest thing in the world. Power down the server, take one of the empty drive trays out, snap the drive into the tray, put the tray back in its slot and snap the drive in. Done. Power up the server and it sees the drive - all you have to do is, through the Home Server console, tell it if you want it to be added to the main server storage or not.

I added both drives to the main body of server storage since I'm ripping DVDs to it and ended up with a total capacity of 2.73TB (1.91TB free).

Adding two 1TB drives gave me a lot of free space for DVDs.

The difference in space is due to that awesome "marketing 1KB == 1000 bytes, computer 1KB == 1024 bytes" thing. You only get about 931MB of actual usable space on a 1TB drive.

Regardless, after these upgrades, my Windows Home Server is a tiny box of awesome. Now I'm going to go set up that Dell Studio Hybrid I ordered for our home theater PC.

UPDATE 2/4/09: I've added an eSATA port multiplier and two more 1TB drives for a total of 4.55TB in storage. It was an easy upgrade that enables future storage upgrades without using the USB ports up.

On Using a Circular Saw

I'm not a big handyman. To be honest, I'm not even a little handyman. I have some tools, I can hang a picture, but when it comes to anything much beyond putting a couple of screws into a board or hammering a nail into a wall, I'm pretty much out of it.

We're putting this thing together at home for our cat box to sit on. It involves cutting a board, and I noticed that I don't really have a saw. To remedy that, when we bought the board, I got a decent mid-to-low-end circular saw. (I obviously don't have a ton of call for such a thing, so spending more than, say, $50 would have been wasted.)

During my first-ever-in-my-lifetime use of a circular saw, I learned a few things I thought I'd share to help out the other less-than-handy people out there:

  • Don't stand on the cord or the saw won't go.
  • Don't pinch the cord between your leg and the table or the saw won't go.
  • If the saw doesn't go, the cut doesn't come out as clean as you might hope.
  • Stop over-thinking it and move the saw faster than a snail's pace or the cut won't be smooth.
  • Sandpaper can go a long way in cleaning up a messy cut on MDF.
  • MDF generates more sawdust than you will ever be able to clean up.

Car's In The Shop, Maybe Back Friday

Took my car in to the shop this morning to get it fixed from my one-way-grid collision. The estimate is that it'll be done and back to me on Friday, but until then, I'm stuck in a rental - a Kia Rondo. My usual car is a 2002 Acura RSX Type-S, so moving over to an odd SUV-identity-crisis with an automatic transmission has me sort of weirded out. I don't really want to try parking it in my garage because I can't figure out where the front and back on the thing are yet.

It's Wednesday, but Friday is comin'...

Choosing a Format for Your DVD Library

I blogged a bit ago about setting up a Windows Media Center DVD Library - where to store, how to handle metadata, etc. What I didn't cover was how to choose a format to rip your movies into.

When I created my DVD Library, I had three primary goals:

  • No loss of quality.
  • Menus, etc. intact.
  • Backup of movie that can be re-ripped to DVD if the original gets damaged.

I ended up selecting VIDEO_TS format for my movies. Based on your requirements, you may choose a different format. The following table outlines some common format choices and their relative pros/cons.

  ISO VIDEO_TS WMV MPEG-2 DivX
Description Full-disc image, sector for sector. [Wikipedia] The files ripped from the disc's filesystem. [Wikipedia] Windows Media Video. [Wikipedia] Moving Picture Experts Group video codec. [Wikipedia] Codec using lossing MPEG-4 compression. [Wikipedia]
Playable in Windows Media Center Requires a plugin like MyMovies in conjunction with Daemon Tools. Yes, by enabling the DVD Library. Yes Yes Requires a plugin like Media Control with FFDShow.
Streams to Media Center Extender (e.g., Xbox 360) Requires Media Center with Transcode360. You won't get FF/RW/Chapters. Requires Media Center with Transcode360. You won't get FF/RW/Chapters. Yes Yes No. (Can play on Xbox360 through file sharing, but not through Media Center Extender.)
Same quality as original DVD Yes Yes No No No
Menus, extra features, etc. intact Yes Yes No No No

All of these can be re-ripped, in some form or another, to a DVD that will play in a standard player, but you can obviously only burn back to disc the data you have. For example, if you rip your movie to WMV, you've lost the menus and quality - you aren't going to get those back by burning the WMV back to a video disc.

File size was omitted because for the lossy formats, you can adjust the amount of size the movie takes on disk by compromising quality. The ISO and VIDEO_TS formats will take between 4GB and 8GB per disc, regardless of movie length, because they're basically the whole kit-and-kaboodle. I've found some discs only use 3GB, but most are between 4 and 8.

A note on quality: When I say there's a quality difference between ISO/VIDEO_TS and WMV/MPEG-2/DivX, it's not just a little bit. You will immediately notice that there are more video artifacts and lower quality sound than if you'd ripped the full movie without additional compression. The more you try to keep the quality, the larger the file size gets until you almost may as well have ripped the full ISO/VIDEO_TS... and even then, you still may notice quality issues. In some cases, you may not care - as long as it's "watchable" it may be good enough for you. I'm a quality freak so I have a really difficult time with compressed video in my home theater, and my wife, who is far less picky than I am, even notices a difference. YMMV.

Given that...

The quick recommendations:

  • VIDEO_TS: If you want a backup with menus, no lost quality, and don't mind watching your movies through a Windows Media Center (or Front Row, for you Mac people), then VIDEO_TS is the way to go. It's the easiest of the two full-rip formats to set up and is most compatible with media center style software.
  • MPEG-2: If you want just the main movie, don't mind losing a little quality, and/or have lots of different devices (PS3, Xbox360, etc.) that you want to watch on, go with MPEG-2. It's a pretty common format that almost everything will play.

Watch Those One-Way Grids

My car got hit last night while I was on my way to get my allergy shot. No big deal, just some paint scratches (as far as I can tell), and no one was injured, but, man, it's just one more thing to deal with.

The other driver and I were heading south on a two-way street and crossed into a one-way grid. He stayed in the right lane, I changed to the left lane (had to turn left soon to get to the shot clinic). He didn't realize we had switched into a one-way grid and turned left in front of me from the right-hand lane. I got to test my brakes out (they're decent) and we hit at super-low speed.

Here's a map of what happened:


View Larger Map

Got the accident reported to the insurance company right at the scene. Cops didn't come because it was so minor. Now I need to pick a body shop and get my bumper fixed up. Really glad no one got hurt, but like I said, just one more thing to deal with. Sigh.

How To Set Up a DVD Library in Windows Media Server

Getting a DVD library going in Windows Media Server is not quite as straightforward as you might think. The information is out there on how to do it, but it's spread far and wide as people writing it up assume you know a bunch of stuff you don't know. Hopefully this will help get you started. [Note: For some context as to how my entire Media Server solution is set up and the goals I had in doing it, check out my overview.]

The goal here is to get your DVDs ripped into a digital format, stored somewhere a Windows Media Center PC can access them, be able to browse the list of available DVDs in a friendly format, and play the DVD as though you had placed the DVD into the tray - menus, extra features, the whole bit.

Note: It may be easier to do some of the things I'm about to describe if you don't hold yourself to the "play it like it's a full DVD" requirement - compressing the movie into an MP4 or something. I'm not going to cover that here because that process is more, "rip the movie, drop it in a folder, and you're done." I'm a quality freak and I want the whole kit-and-kaboodle, so that's what I'll cover. On the other hand, the only way to get things to work through a Media Center Extender (like an Xbox 360) is by compressing the movie. I'm not doing that, so my quality freak nature holds.

Note 2: I'm explaining this in Windows Vista terms, so paths and such will be Vista-oriented. There are similar settings you can use in Windows XP Media Center, but I haven't actually tried them so I don't want to provide advice on them.

Step 1: Determine where to store the ripped movies.

Windows Home ServerA ripped DVD can take up to 8GB of space. For a sizable library, you're looking at possibly a terabyte drive or larger. If you plan on only having one Windows Media Server, it can all be attached to that PC. If you might want to have more than one Windows Media Server, you'll want to store the ripped DVDs on a file server on your network somewhere.

There are plenty of solutions for storing stuff on your network, from NAS solutions to dedicated file servers. I ended up getting a Windows Home Server and really like it. If you are able, I recommend it.

Step 2: Choose a format to rip your movies in.

For a full-disc rip, you have your choice of ripping the disc in ISO format or VIDEO_TS format. ISO format basically takes a full image of the disc, sector for sector, and stores that in one file. VIDEO_TS format just takes the files that are on the disc and puts those in a folder you specify. From a backup standpoint, ISO is going to produce a more literally accurate reproduction of the disc, but you can burn VIDEO_TS folders back to a DVD you can watch in a regular DVD player, too, so if you don't mind losing things like, oh, the disc's volume label, I'd go with VIDEO_TS for two reasons:

First, VIDEO_TS seems to be much more portable from an application playback standpoint. If you happen to have a Windows Media Center and a Mac running Front Row, for example, both can play back the same VIDEO_TS folder structure without issues. If it's ISO, you generally need to configure some sort of ISO mounting tool on each front end to fool the system into thinking it's a real DVD.

Second, VIDEO_TS rips seem to take much less space on disk. Space conservation, when you're sometimes looking at one or two GB, is a good thing.

To that end, this step is sort of misleading. You'll want to rip your movies in VIDEO_TS. But now you know why. (I've also posted a blog entry with some additional details about choosing a format. Much of this DVD Library setup guide won't pertain to you if you choose a format other than VIDEO_TS, but if you want to look at different formats, here's my comparison.)

Step 3: Rip your movies.

There are lots of different DVD ripping tools out there to choose from. I, personally, use the free DVDFab HD Decrypter, which comes as part of the commercial DVDFab product. (Make sure you get the "CSS Version" or you'll not be able to rip CSS encrypted movies. The link I provided should get you there.)

DVDFab HD Decrypter - Full disc rip settings

When you rip your movies, the organization is important. Movies should generally exist in a flat folder structure, and every folder name must correspond to the name of the movie it contains. This is probably easier to show in an example.

Say I have everything stored on a \\server\DVD share. When I explore \\server\DVD, I'll see a hierarchy like this:

  • \\server\DVD
    • Movies
      • Aliens (1986)
        • AUDIO_TS
        • VIDEO_TS
      • Blade Runner (1982)
        • AUDIO_TS
        • VIDEO_TS
      • Die Hard (1988)
        • AUDIO_TS
        • VIDEO_TS
    • TV
      • Alias
        • Season 01
          • s01e01e02e03
            • AUDIO_TS
            • VIDEO_TS
          • s01e04e05e06e07
            • AUDIO_TS
            • VIDEO_TS

...and so on. Under that \\server\DVD share, I split things into Movies and TV.

Under the Movies folder, there's one folder for each movie named with the movie title and year, and in each movie's folder, you'll see AUDIO_TS and VIDEO_TS folders - the results of the ripping process.

Under TV, there's a folder for the TV series, then a folder for each season, and for each disc in the season there's a folder that is named with the convention sXXeYYeYY that tells which season and which episodes are on each disc. In the example, you can see two discs in Alias season 1 - the first disc has season 1 episodes 1 through 3; the second disc has season 1 episodes 4 through 7.

UPDATE 12/29/11: This folder structure is slightly more detailed than my originally chosen structure due to my new adoption of XBMC as the front end. It doesn't impact my use of Windows Media Center, though - it will work for both so it's a good structure all around.

Using your ripper, rip the entire movie in VIDEO_TS format to the appropriate area on your network. It seems to be generally faster to rip to a local drive and copy the results of the rip over to the right location on the network than it is to rip directly to the network, but YMMV.

Two notes if you choose to use DVDFab HD Decrypter: First, it creates sort of an odd folder structure that actually seems to put the AUDIO_TS and VIDEO_TS folders down two or three levels from where you tell it to rip to. If you're ripping local and copying to the network, just copy the stuff it rips and nests down in the folder structure - you don't need to go all the way back up to the "FullDisc" folder it creates (you'll know it when you see it). Second, DVDFab HD Decrypter gives you the option to rip non-movie-related files, like PC content (Flash executables, images, etc.) when you rip the movie. I do this, but you don't have to. If you happen to see a "JACKET_P" folder that it rips as a peer to VIDEO_TS, that's what that is. When you copy to the network, go ahead and copy all of the extra files it rips, too. It won't hurt anything, it just won't be used by Windows Media Center.

UPDATE 3/30/09: I created a script that fixes up the DVDFab HD Decrypter folder structure so you don't have to fuss with the "FullDisc" folder anymore.

Step 4: Determine how you want to handle your metadata.

When you browse through your movies, you'll probably want to see the cover image for the movie, the title, the year it was made, and other metadata about the movie. There are a lot of ways to get this to happen, and all of them require some sort of noodling around. This is, by far, the hardest step on the list because there are so many choices.

A lot of folks use, and enjoy, the My Movies plugin for Windows Media Center. It's a very robust plugin that has a server component (which serves up the metadata and is where you manage your collection) and a client component (which gets installed on the Windows Media Center itself), and it may be that you have to install both on the same box if you only have the one Windows Media Center. It lets you navigate in all sorts of ways through your library - by genre, cast member, etc. It also has a very robust metadata engine that can either get data from a web service or import it from DVD Profiler, an amazing collection management tool (that I do use and recommend).

That said, My Movies is a plugin, and it does require a lot of fudging around, and I'm a big fan of just getting the out-of-the-box stuff to work for me with minimal hackery (less hackery == less that should break, though sometimes that's incorrect). If you choose My Movies, more power to you - this is where this guide ends for you.

On the other hand, if you choose to use as much out-of-the-box Windows Media Center functionality, you'll be looking at enabling the "DVD Library" functionality to read your ripped movies and display the metadata there.

So, again, this was sort of a trick step - we're going with the built-in "DVD Library" in Windows Media Center.

UPDATE 9/24/08: There are some shortcomings with the built-in DVD player you might not like which I discovered after writing this guide and ripping a lot of movies. I've found that the quality is mediocre, and if you have a DVD that plays in "4 x 3 widescreen" (that is, it's a 4 x 3 movie that has letterboxing such that you see a black box all the way around the movie), the built-in DVD player won't let you "zoom in" or anything to clean that up. There is not, as far as I can tell, a way to integrate a different DVD player into the "DVD Library" feature. If you want a different DVD player, My Movies has good integration with the TheaterTek player and that seems to be a very common solution to the problem.

UPDATE 1/6/09: You can mess around with the aspect ratio and zoom options in the built-in DVD player by pushing the info "i" button on the remote or, I think, right-clicking on the video as it plays.

Step 5: Enable the DVD Library in Windows Media Center.

Out of the box, the "DVD Library" feature on Windows Media Center isn't enabled. You'll need to enable it with a registry setting. Per this Microsoft KB article (and my own experience), locate this registry subkey:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Media Center\Settings\DvdSettings
...and find the ShowGallery key. Change the value of ShowGallery to be Gallery.

Once you've applied that, when you launch Windows Media Center you'll see the "DVD Library" under "TV + Movies."

The DVD Library appears under "TV + Movies" once it's enabled.

Step 6: Configure Windows Media Center to find your ripped DVDs.

Now you need to tell Windows Media Center where your DVDs are ripped to.

  1. Open Windows Media Center.
  2. Go to Settings -> Library Setup.
  3. Select "Add folder to watch" and click Next.
  4. Here you can either select to "Add folders on this computer" (if you ripped your DVDs to the Windows Media Center PC) or "Add shared folders from another computer" (if you ripped your DVDs to a network location). Click Next.
  5. Select the place where you ripped your DVDs. You only need to select the top level folder (e.g., \\server\DVD) and you're set.

There is a decent walkthrough of this when using a Windows Home Server over at We Got Served that has some screen shots.

Note: Some folks have found that after adding the folder to watch their movies don't show up, even after restarting Media Center. If you've added your movie folder and it's not finding your movies, try restarting Media Center. If it still doesn't find your movies, you may have to add the folder through the DVD Library:

  1. Open Windows Media Center.
  2. Go to the DVD Library.
  3. Inside the DVD Library, right-click and select "Add Movies." This will take you to a similar screen as the Library Setup (noted above) where you can add folders to watch that contain movies.

Step 7: Add the movie metadata.

Getting the metadata attached to your ripped movies is the last step in getting a nice DVD library going. Once you have metadata, navigating through your library and picking movies is simple, easy, and friendly for all members of the family.

Cover Image Only:

If you don't care about anything but the cover image, it's excruciatingly simple. Place a cover image for the movie inside the folder just above the VIDEO_TS folder and call the image folder.jpg. That's it. Windows Media Center will use the name of the folder as the name of the movie and automatically use this image as the cover image and you're done. It'd look like this:

  • \\server\DVD
    • Movies
      • Aliens (1986)
        • folder.jpg
        • AUDIO_TS
        • VIDEO_TS
      • Blade Runner (1982)
        • folder.jpg
        • AUDIO_TS
        • VIDEO_TS
      • Die Hard (1988)
        • folder.jpg
        • AUDIO_TS
        • VIDEO_TS

I actually want full metadata, though, so that's not good enough for me.

Full Metadata:

The way Windows Media Center stores metadata is not necessarily straightforward, so it helps to undestand it before you make a choice on how to deal with this.

When you insert a real DVD, Windows Media Center reads an ID from the disc. This ID is a set of two eight-digit hex numbers, like "70464E8C-56B47572." Windows Media Center uses this information to go online and retrieve information about the movie like cast information, the main movie length, and the cover image.

The information it retrieves gets stored in the C:\Users\USERNAME\AppData\Roaming\Microsoft\eHome\DvdInfoCache folder (where "USERNAME" is the name of the user running Media Center). For each disc loaded, you'll see a corresponding XML file. Using the above example, you could look in that DvdInfoCache folder and you'd see a file called 70464E8C-56B47572.xml. The contents of that file look like this:

<?xml version="1.0"?>
<METADATA xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <MDR-DVD>
    <MetadataExpires>2008-12-10T18:49:18.5430057-08:00</MetadataExpires>
    <version>5.0</version>
    <dvdTitle>13 Going on 30</dvdTitle>
    <studio>Columbia TriStar</studio>
    <leadPerformer>Jennifer Garner; Mark Ruffalo; Judy Greer; Andy Serkis; Kathy Baker</leadPerformer>
    <director>Gary Winick</director>
    <MPAARating>PG13</MPAARating>
    <language />
    <releaseDate>2004 01 01</releaseDate>
    <genre>Romance</genre>
    <largeCoverParams>cov150/drt400/t455/t45554fmujx.jpg</largeCoverParams>
    <smallCoverParams>cov075/drt400/t455/t45554fmujx.jpg</smallCoverParams>
    <dataProvider>AMG</dataProvider>
    <duration>98</duration>
    <title>
      <titleNum>1</titleNum>
      <titleTitle>13 Going on 30 [Special Edition]</titleTitle>
      <studio>Columbia TriStar</studio>
      <director>Gary Winick</director>
      <leadPerformer>Jennifer Garner; Mark Ruffalo; Judy Greer; Andy Serkis; Kathy Baker</leadPerformer>
      <MPAARating>PG13</MPAARating>
      <genre>Romance</genre>
      <synopsis />
      <chapter>
        <chapterNum>1</chapterNum>
        <chapterTitle>Start</chapterTitle>
      </chapter>
      <chapter>
        <chapterNum>2</chapterNum>
        <chapterTitle>Thirteen</chapterTitle>
      </chapter>
      <!-- Add'l chapters elided for demo purposes -->
      <chapter>
        <chapterNum>28</chapterNum>
        <chapterTitle>Course Correction</chapterTitle>
      </chapter>
    </title>
  </MDR-DVD>
  <NeedsAttribution>true</NeedsAttribution>
  <DvdId>70464E8C|56B47572</DvdId>
</METADATA>

There's a whole bunch of content in there - that's the stuff that gets displayed on the screen, and that's what you need to get into your ripped movies. You need to fool Windows Media Center into getting the proper DVD ID from each of your rips.

Fortunately, that's actually easier than you think.

What you can do is place a tiny XML file in the folder that contains the VIDEO_TS folder. The name of the XML file is "MovieName.dvdid.xml" where "MovieName" is the name of the movie (which should also be the name of the folder containing the movie - it all needs to match). That looks like this:

  • \\server\DVD
    • Movies
      • Aliens (1986)
        • Aliens.dvdid.xml
        • AUDIO_TS
        • VIDEO_TS
      • Blade Runner (1982)
        • Blade_Runner.dvdid.xml
        • AUDIO_TS
        • VIDEO_TS
      • Die Hard (1988)
        • Die_Hard.dvdid.xml
        • AUDIO_TS
        • VIDEO_TS

Inside these tiny XML files are two lines - the name of the movie and the movie's DVD ID. A sample looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Disc>
  <Name>13 Going on 30 Special Edition</Name>
  <ID>70464E8C|56B47572</ID>
</Disc>

When Windows Media Center sees that, it thinks it's a real DVD and it'll go to its online service and automatically download all of the real metadata into the DvdInfoCache like I showed you earlier. The question is, how do you get those tiny "dvdid" files?

UPDATE 12/29/11: If you're using DVDFab HD Decrypter to rip your discs, there's an option in it to leave the dvdid file in the folder along with the rip so you don't need to use the DVDXML web site.

If you already have the rip or otherwise need the file, though, what you need to do is go to the DVDXML web site and get a free account. The point of the DVDXML site is to provide you with these tiny "dvdid" files that you need to fool Windows Media Center into downloading the rest of the metadata for you. Sign up, sign in, and search to find the one that matches the DVD you ripped. It seems to be a pretty complete database.

What if the info isn't on DVDXML? You have a couple of options. First, you could post to their forums and request it. Second, you could create it yourself, and there's a tutorial on how to do it, but I can't say I've done this yet so I don't know how easy it is. That tutorial mentions that DVDFab 5 (the commercial version of DVDFab HD Decrypter) will make these for you, but I've not tried it. In general, the trick is going to be getting the DVD ID; it doesn't seem that the "Name" element in that "dvdid" has to actually match anything. It'd probably be easy enough to do by hand if you can get the ID.

What if I'm not online or want to generate the full metadata myself? Seriously, it's going to be far easier for you if you just let the system do the download work for you, but if your Windows Media Center isn't connected to the network and you need to generate it all yourself, there seem to be a few options. Eric Charran has done it using a program called DVD Library Manager that uses Amazon and IMDb to get info. There's another program called "MyDVDs" that is on a site that contains pre-generated complete versions of the data and will automatically download those for you (or you can manually download individual files). The idea is that you still get a "dvdid" file, but it generates the stuff in the DvdInfoCache for you, too, and omits the need for the system to look the data up. Again, the simplest route is to use DVDXML and put the "dvdid" file in your movie folder and let the system do the work for you.

What if I customize the metadata that gets downloaded? For example, you may change the title of the movie that gets displayed to be more accurate. If you do, there's a bit of an interesting issue. The metadata comes with an expiration tag that has a date on which the item will be refreshed in the DvdInfoCache folder. If you change the metadata XML, your changes will be lost when the data gets refreshed. You can either manually edit the file in the DvdInfoCache to be a date really far in the future (so it never expires), you can remove the "MetadataExpires" element from the top, or you may actually want to generate the full metadata yourself. See above for more on that.

What do I recommend (so far)? I'm learning, so I'll probably update this post and this recommendation as time goes on, but right now what I'm doing is:

  • Use DVDFab HD Decrypter and/or DVDXML to get the initial "dvdid" file. You'll need that anyway.
  • Open Media Center and visit the DVD Library once to download the initial set of metadata. This does a quick, automated pre-population of most of the requisite fields.
  • Use DVD Library Manager to update any missing fields and/or modify the titles, etc. through Amazon and IMDb. Saving in DVD Library Manager will also remove the "MetadataExpires" attribute so you don't have to fear any changes getting deleted.

 I'm also going to set up my DvdInfoCache so it's stored on the server using a mapped drive via the Vista "mklink" command. That way any additional Media Center PCs I hook up will have all the same data.

I haven't determined yet if I can/should leverage the DVD Profiler database that I already have going. There are nice high-res cover scans there that I'd like to take advantage of, and it's a nicely formatted and consistent set of data to pull from.

 

This process is exactly what I'm doing to get my full DVD library ripped and accessible. So far it has pretty decent Wife Acceptance Factor, and I like having accessibility to my movies without having to do a lot of additional work. Hopefully this can help you to get your DVD library in order.

Two Weeks In With Windows Home Server: What I've Learned

HP MediaSmart ServerIt was two weeks ago that I picked up my Windows Home Server and on the whole, I really do like it. Hanselman seems to like his, too, and his review helped a lot when I was getting things going. That said, there's a lot I wish I had known as I was setting things up, so here's a rundown of some of the things I've learned.

Initial Setup:
There's a lot more to setting it up than just plugging it in and turning it on. The setup guide that comes with the server runs you through some of that, but there's definitely some "follow the on-screen instructions" detail-free action in that guide and it's nice to know up-front what you're looking at. I found a really nice online description of the initial setup steps for the server that you'll want to check out.

Pre-Configured Shares:
There are pre-configured folders for sharing Video, Music, and Pictures. If you go with the pre-configured defaults and just put the things you want to share into the respective folders, life will be easy for you. You can override these defaults and do your own thing, but there's no real compelling reason to do that and it'll just be difficult.

There are also pre-configured shares for software installation (like the recovery CD contents in case your backed-up computers take a dive; and Home Server add-ins) and each user that has an account on the machine. Again, if you just accept the defaults, your life will be easier.

Media Sharing is Through Windows Media Connect:
The default media sharing is done through Windows Media Connect. For the most part, it works really well... unless your music is based in iTunes and you have a lot of, say, Apple Lossless format music like I do. WMC only supports a few formats and will filter out anything it can't stream to a client (like your Apple Lossless music) so when you see the server appear on your Playstation 3 or Xbox 360 and only half your music is appearing, that's why.

The WMC limitations also affect video formats, so if you've got your videos stored in the Videos folder and you're not seeing them on your client, it's probably a video format issue.

You can potentially overcome some of these issues by using the PVConnect add-in (see below) with the server, but I can't really tell. A better solution is to run a real media server (like Windows Media Center) which can handle a more robust set of media formats.

PVConnect/TwonkyVision Add-In:
The HP MediaSmart Server comes with an add-in called "PVConnect" that appears to have something to do with the TwonkyMedia "TwonkyVision" server. Honestly, I'm having a hell of a time finding any real detail on it. The only concrete thing I can find is that it will provide album art for your music (if the files have album art) and will "transcode" your photos so they display properly on whatever device is requesting them. Neither of these things are compelling enough for me to want to install an add-in without knowing what else is going on. It looks like there were some issues with it working with Playstation 3, but you can do a little manual hack to get around it.

I'd love for someone to tell me more about how this thing works and what it does. If it'll enable Apple Lossless streaming, I'll totally install it.

iTunes Library Sharing:
The HP MediaSmart Server also comes with an "iTunes Library Sharing" facility that is comprised of two parts: a client part, that reads in your library/music info and copies it to the server; and a server part, that streams the aggregated contents of the "Music" folder over the network in iTunes format so you'll see it in iTunes as a shared library.

If you already store your iTunes music in the "Music" folder (like if you're following my multi-user iTunes instructions or if you've got iTunes generally set up to store your library on the network), you probably don't want the client part running. The problem is, it'll see your iTunes library and then try to copy that again into the shared "Music/iTunes" folder on the server. I've read a few horror stories about duplicate copies of songs ending up in the share and confusing things. The downside of not having the client portion running is that you won't get your playlists to display in the shared library... but maybe that's not a big deal. It's not for me. The client portion of sharing is disabled by default.

iTunes sharing settings for the client.

The server portion of the iTunes shared library service works just like standard iTunes library sharing - you can stream music from the shared library, you can listen to shared playlists, but you can't add items from the shared library to your own playlists or sync the content to your iPod. It will automatically add anything in the shared "Music" folder into the shared library, even if the content wasn't originally in iTunes. ("Adding it to the library" means it'll add it to the list of things that can be streamed from this shared library. It doesn't mean any files are getting moved around anywhere.) This is enabled by default on the server.

iTunes sharing settings on the server.

Since my goal here was more just to store the music on a central server, not to have "shared library" content or whatever, I have both the client and server portions of the iTunes music sharing component disabled. If/when I do end up trying to get actual iTunes content with playlists and all streaming across the network, I'll probably be looking at either just using a Mac Mini as my media center PC or using MCETunes to get Windows Media Center to recognize iTunes content. (I've blogged about MCETunes before.)

RAM Upgrade:
A lot of folks online say you'll see a huge performance gain by upgrading the 512MB RAM that comes with the MediaSmart server to 2GB. I, personally, haven't run into any performance problems yet - it works peachy keen with the 512MB. That said, if I do run into issues, it looks pretty simple to do the upgrade, so I'll probably look into it then.

Photo Organization is Important:
The way Windows Media Connect shares photos, it actually exposes the folder structure you store your photos in. If you've not been organizing your photos too well, you're going to see a mess when you try to browse from your Xbox or Playstation. I tend to organize by date, with top-level year folders and subfolders with the full date in YYYYMMDD and a description of the event being photographed - that way they sort, alphabetically, in date order. It looks like this:

  • 2004
  • 2005
  • 2006
  • 2007
    • 20070704 - Independence Day
    • 20071225 - Christmas
  • 2008
    • 20080704 - Independence Day
    • 20080723 - Trav's Birthday
    • 20080908 - Screen Shots of Windows Home Server

This makes it very nice and easy to browse when you're looking at it from a client.

Online Backup:
I was backing up my computers using Mozy, but the Windows Home Server offers a full backup feature, too, so I've pretty much switched over to using that. Of course, I need to get the Windows Home Server backed up, so I started looking at options there.

Philip Churchill has a great writeup of various online backup solutions for Windows Home Server. I wanted to stick with Mozy, but they require you to get a Mozy Pro account to back up your Home Server, which costs $0.50/GB per month... and with 110GB of music alone, that's $55/month to back up something I can back up for $50/year from my laptop. Disqualified. I also considered Carbonite but really wanted something that's officially supported, and while they say it should work, they won't support you backing up Windows Home Server. I'm also not interested in "tweaking things" to get it to work - one of the beauties of the WHS so far has been its "appliance-like" simplicity. I'm not eager to break that. Disqualified.

In the end, I picked KeepVault. It's $100/year for unlimited storage and has a really nice Windows Home Server add-in so you can see your backup status and do restores right from the console. You tell it which shares you want to keep backed up and it does the rest. The only downside to this is it's not backing up the OS or your computer backups... but since you can recover the OS reasonably easily, and the chances of my computers AND my WHS taking a dive at the same time are minimal, this is a perfect solution to me, and it seems other folks have had success with it, too. I'll keep any really precious documents in my user share on the Home Server so they'll not only be duplicated (for hardware failure fault tolerance) but also backed up by KeepVault. The rest will get backed up by the standard Windows Home Server computer backup facility. Done.

UPDATE 2/25/09: KeepVault has raised its prices to be far, far less affordable and there is no unlimited storage option. Once my current subscription expires, I will most likely switch over to use the built-in Windows Home Server option to backup to a USB drive and store the backups off-site myself.

Ripping DVDs:
One of my primary goals for getting the server was to store my VIDEO_TS rips of my DVDs so I can play them through some sort of media center. I've gotten this working - even over wireless, which was cool - through my primary laptop and Windows Media Center on Vista Ultimate.

It might sound obvious, but when you rip a DVD, rip it to your local drive first and then copy the files to the server. I found the ripping process was cut from like an hour and a half to about 20 min. when ripping it locally. Then you can start the copy over to the server while you're ripping the next disc.

You will probably want to create a new shared folder on the server outside of the default "Videos" folder that it comes with. Since the server won't stream VIDEO_TS or ISO anyway, you're not losing out on functionality. That said, you probably don't need file duplication turned on for your ripped movies or you'll be chewing through space. Creating a separate "DVD" share to store your rips in will let you selectively turn off duplication for just the rips.

You'll probably also not want to set your online backup solution to back up the rips. On both Mozy and KeepVault, it seems to take about a day to back up 7GB, and if you've got a lot of movies like I do, it's going to take years to get the backup completed. Plus, if you ever do lose the data, it'll be far faster to just re-rip the movie (or even go to the store and re-purchase it, if the disc has been destroyed, and re-rip) than it would be to get the content back from the online backup service. Save the online backup service for your photos, music, smaller videos, and documents.

Continued Work on My Home Media Solution:
I'm still learning about the way to handle things - which program I like best for ripping DVDs, what the best way to add metadata to Windows Media Center for the ripped discs is, etc. - and I'll post updates as I find them. I found one blog that explains almost an identical setup to what I'm trying to put together, so that's been a lot of help. Right now the decision I'm trying to make is whether to go with Windows Media Center or whether to go with some sort of Mac solution, maybe using Front Row. I seem to be able to find information on WMC a lot easier, but maybe I'm just not looking in the right places. On the other hand, most of the Mac solutions seem to be appliance-like, just like the Home Server, and I'm a big fan of simple. We'll see.

CR_Documentor 2.2.0.0 Released

CR_Documentor 2.2.0.0 has been released and includes several bug fixes for rendering issues as well as some fixes/enhancements around the internal preview web server. Check out the version history to see the list of all the resolved issues and added features, then go get it!

Testing Lists with Typemock Isolator

I've seen this question a few times in the Typemock forums so I figured I'd post a little something on it:

How do you mock a list using Typemock Isolator?

The challenge we currently have is that Isolator can't mock types that are declared in mscorlib, which includes things like List<T>, so if you expose a list in your class, you have some potentially interesting mocking challenges, depending on how you choose to expose it.

If you wrap the list in methods/properties on your class, when you set up mocks, you'll be setting up mocks against your class - not the list - so there is no problem there. If you expose the list as a public field, that's where the challenge sets in.

Below is a code snippet showing an example class that does both things: it has a method and a property that "wrap" a list, and it has a public list field. Below that, you'll see tests that illustrate different ways to handle the situations using Typemock Isolator.

public class ListExample
{
  // Publicly accessible list field
  public List<string> PublicList = new List<string>();
  
  // Private list that gets "wrapped" by methods/properties
  private List<string> _privateList = new List<string>();
  
  // Wraps the indexer of the private list
  public string this[int index]
  {
    get
    {
      return _privateList[index];
    }
    set
    {
      _privateList[index] = value;
    }
  }
  
  // Wraps the Add method on the private list
  public void Add(string value)
  {
    _privateList.Add(value);
  }
}

[TestFixture]
[VerifyMocks]
public class ListTestFixture
{
  // The problem we have is you can't mock types in mscorlib
  // so you need to either wrap the list or mock the field.

  [Test]
  public void WrappedList()
  {
    // If the list is "wrapped" in members of a type not
    // in mscorlib, we have it pretty easy because the
    // mocks get set up against the members on the ListExample
    // type, not against the List<T> object.
    
    ListExample example = new ListExample();
    using(RecordExpectations recorder = RecorderManager.StartRecording())
    {
      // No matter what index we ask for, we always want
      // the "expected" value to come back.
      string dummy = example[0];
      recorder.Return("expected");
      recorder.RepeatAlways();
    }
    
    // Put these values into the list...
    example.Add("a");
    example.Add("b");
    example.Add("c");
    
    // ...But what we get out is the mock value.
    // We can even ask for out of range indices.
    Assert.AreEqual("expected", example[0]);
    Assert.AreEqual("expected", example[1]);
    Assert.AreEqual("expected", example[2]);
    Assert.AreEqual("expected", example[3]);
    Assert.AreEqual("expected", example[4]);
  }
  
  [Test]
  public void FieldListMocks()
  {
    // Here the challenge is that there aren't any
    // members on the ListExample object that wrap
    // the list so we've actually got to "mock" the
    // list proper.
    
    // To accomplish the mock, we'll modify the object's
    // state by poking in our expected field value.
    ListExample example = new ListExample();
    ObjectState state = new ObjectState(example);
    List<string> expectedList = new List<string>();
    expectedList.Add("expected");
    state.SetField("PublicList", expectedList);
    
    // Now when we ask for the list, we're getting the
    // expected list, not the original member.
    Assert.AreEqual("expected", example.PublicList[0]);
    
    // When we're done, we can reset things back to the
    // original values, which means the real PublicList
    // will be back - and will still be empty.
    state.ResetState();
    Assert.IsEmpty(example.PublicList);
  }
  
  [Test]
  public void FieldListReflection()
  {
    // Of course, you can always do it the brute
    // force way, too, through reflection. It doesn't
    // look much different from the ObjectState version,
    // above, but we can't "return to the original
    // value" at the end of the test.
    ListExample example = new ListExample();
    List<string> expectedList = new List<string>();
    expectedList.Add("expected");
    
    typeof(ListExample)
      .GetField("PublicList",
        BindingFlags.GetField | BindingFlags.Instance | BindingFlags.Public)
      .SetValue(example, expectedList);
    
    // Now when we ask for the list, we're getting the
    // expected list, not the original member.
    Assert.AreEqual("expected", example.PublicList[0]);
  }
}

As you can see, testing with the list solely as a backing data store and exposing the values only through members on your own class is far easier and less... code-smelly... than exposing the list directly as a field. Generally speaking, you shouldn't expose public or protected fields anyway, opting for property get/set instead to allow for more flexible implementations later should the need arise. That said, if you have something you've got to test using a public list field, above are some ways to do it.

Don't Clog the Tubes!

OK, my favorite Chrome Easter egg (actually, the only one I've heard, but still, so awesome) is if you type "about:internets" in the address bar. Too funny.

Microsoft Patterns & Practices Team Uses Typemock Isolator

The Typemock Insider blog mentions that Patterns & Practices has adopted Typemock Isolator as their mocking framework, at least for testing SharePoint applications. Blaine Wastell and Francis Cheung say they're using it because it allows them to mock sealed and internal types, which SharePoint is full of.

I think this is cool and definitely says something: Even if you're writing brand new code, which can be entirely designed for testability (if that's what you want), at some point you're going to have to interface with something you didn't write (SharePoint, .NET Framework) and you're still going to want to test that interface code, which is where Isolator comes in. I'm so glad they've got an open source license now!

Media Center Storage Win

I got a "prototype system" up and running for a media center solution using my new Windows Home Server as the storage for the video. I set up a new shared folder called "DVD" on the home server and fixed it so it's not using file duplication (no need eating up double the amount of space for each movie), then ripped a disc to it.

My laptop is running Vista Ultimate, so I set up the DVD Library to automatically watch for movies in the DVD shared folder and enabled it to play VIDEO_TS folder structures following the instructions here. Doing this worked perfectly and it played the ripped disc as though I had put it into the local drive. Exactly what I was looking for. It even played without glitches over the wireless network, which was surprising, but very cool.

The next step is to figure out how I want to deal with the media center itself. I know I'm going to need some sort of dedicated machine, so that will probably end up being a Mac Mini, similar to the "death of DVD" story I was reading. The question is, what software do I want to run?

  • Under Windows Vista Media Center, I have two choices:
    • The out-of-the-box DVD Library, which is the simplest way to go but doesn't offer much in the way of searching/sorting by genre, cast, etc.
    • My Movies, a plugin for Media Center, which provides a much richer interface but also is higher-touch. There's a server component I'd have to install on the Windows Home Server that, frankly, scares me because the WHS is working so well right now, I'd hate to start hacking on it.
  • Sticking with straight Mac, I have some choices, too (probably more than I'm aware of):
    • Front Row, which, as of version 10.5, finally supports playback of VIDEO_TS folders. Doesn't look like it's much richer than the DVD Library in Vista Media Center, but if I went Mac Mini, it'd require less to be installed on the Mac. (No Boot Camp running Vista, for example.)
    • Matinee, which looks pretty thin. I'm thinking if Front Row supports VIDEO_TS, I'd probably be best off with that over Matinee.
    • DistantDVD, which is also pretty thin but is specifically geared towards what I'm trying to do - play the video off the network. It doesn't show any more info than the DVD Library, though, so, again, if Front Row supports VIDEO_TS over the network, that might be the way to go.

There are technically a lot of other choices for both platforms, but I've ruled out non-Windows-Media-Center choices for the Windows platform because I really don't need most of the options the other servers offer and I don't want to hassle with a lot of extra configuration and hackery. I didn't list any different platforms for the Mac because, frankly, I'm ignorant. I'm really hoping to keep it simple, though, so as much out-of-the-box, it-just-works as I can get, the better.

It looks like it boils down to a small hierarchy of choices:

  • Do I need to have cast/genre/etc. information with the movies or is the title and cover art enough?
    • If I need more than title/cover art, My Movies seems to be the way.
    • If I don't need more than title/cover art... Do I want to use out-of-the-box Mac stuff or do I want Vista Media Center?
      • If it's OOTB Mac, which would be the easiest, it looks like Front Row is probably the answer.
      • If it's Vista Media Center, DVD Library.

I'll do a little more research on Front Row, but my media center solution is getting close...