Monday, January 18, 2010

HP MediaSmart Server/MediaCollector: Making Custom Paths Work


This post applies to HP MediaSmart Server models EX490 and EX495 with HP software version 3.0.14.33083 8/11/2009.

The HP MediaSmart Server includes a tool called the Media Collector which scans your computers and copies media files onto the server. When you add a client (i.e. a computer) to the Media Collector configuration, it offers you the opportunity to specify custom paths to search. This is important for those of us who don't keep all our files under our home directory (folder).

Unfortunately the UI to specify a custom path is badly broken for many users at this time. On my system, if I'm persistent I can add a top-level path (e.g. "L:\") but can only rarely get even one level below that.

In this post I explain how to workaround the problem by manually editing the Media Collector configuration database. This technique is for advanced computer users. While I've tried to explain it thoroughly, it assumes that you have at least basic familiarity with such concepts as SQL databases and editing XML. I wish it were simpler, but it isn't ...

1. Log into your MediaSmart Server system using Remote Desktop Connection (RDC).
Hint: Find RDC under All Programs::Accessories.
Your MediaSmart Server is running a version of Windows called Windows Home Server (WHS) and is normally accessed through the WHS Console application. But to do what you need here, you need access to the full system.
NOTE: All remaining steps take place on the WHS system.

2. Open Explorer and locate the database folder used by the HP MediaSmart Server.
You can find it somewhere under "D:\folders" -- on my system it is "D:\folders\{2D2552D3-5884-4D18-9608-DC65BB76026A}" -- just look for the file "mssdb.db".
3. Open a command window and cd to the database folder.
...> cd D:\folders\{2D2552D3-5884-4D18-9608-DC65BB76026A}
...> d:
4. Now fire up the SQLite shell on the MSS database. Fortunately HP left one around for us to use, otherwise you could download it from sqlite.org.
...> "C:\Program Files\Hewlett-Packard\HP MediaSmart Server\sqlite3.exe" mssdb.db
Useful SQLite References:
5. Explore the database a little.
sqlite> .tables
McClient McConfig McFileEntry McMediaType
McClientVersion McDuplicates McFileEntryRequest McRequestNumber
The McConfig table is the one we want. Take a look at its schema:
sqlite> .schema McConfig
CREATE TABLE [McConfig](
[Target] [nvarchar] PRIMARY KEY NOT NULL,
[ConfigXml] [Text] NOT NULL);
This shows us that the table has two fields: "Target" and "ConfigXml". Now let's see how they are used. The following command displays the contents of all records in the table:
sqlite> select * from McConfig;
Note for the excessively curious: the full schemas for mssdb are found in its creation script,
C:\Program Files\Hewlett-Packard\HP MediaSmart Server\scripts\mssdb.sql


6. To make things simpler, you can look at just the configuration data for a single client. In this example the client is named "superfortress":
sqlite> select ConfigXml from McConfig where target = "superfortress";
Here's an example of what you might see:
<?xml version="1.0"?><MSS_MC_ClientConfig><Version>3.0.1</Version>
<ClientName>superfortress</ClientName><MediaRecord><MediaType>Photo</MediaType><
IsEnabled>true</IsEnabled><SourceLoc>Home</SourceLoc></MediaRecord><MediaRecord>
<MediaType>PhotoVideo</MediaType><IsEnabled>true</IsEnabled><SourceLoc>Home</Sou
rceLoc></MediaRecord><MediaRecord><MediaType>Music</MediaType><IsEnabled>true</I
sEnabled><SourceLoc>Home+iTunes+WMP</SourceLoc></MediaRecord><MediaRecord><Media
Type>AlbumArt</MediaType><IsEnabled>true</IsEnabled><SourceLoc>Home</SourceLoc><
/MediaRecord><MediaRecord><MediaType>Playlist</MediaType><IsEnabled>true</IsEnab
led><SourceLoc>Home+iTunes+WMP</SourceLoc></MediaRecord><MediaRecord><MediaType>
Video</MediaType><IsEnabled>true</IsEnabled><SourceLoc>Home</SourceLoc></MediaRe
cord></MSS_MC_ClientConfig>
As you can see, the configuration data is stored as XML text. It's hard to read this way -- here it is pretty-printed (well, it was pretty until Blogger banished the indenting):
<?xml version="1.0"?>
<MSS_MC_ClientConfig>
<Version>3.0.1</Version>
<ClientName>superfortress</ClientName>
<MediaRecord>
<MediaType>Photo</MediaType>
<IsEnabled>true</IsEnabled>
<SourceLoc>Home</SourceLoc>
</MediaRecord>
<MediaRecord>
<MediaType>PhotoVideo</MediaType>
<IsEnabled>true</IsEnabled>
<SourceLoc>Home</SourceLoc>
</MediaRecord>
<MediaRecord>
<MediaType>Music</MediaType>
<IsEnabled>true</IsEnabled>
<SourceLoc>Home+iTunes+WMP</SourceLoc>
</MediaRecord>
<MediaRecord>
<MediaType>AlbumArt</MediaType>
<IsEnabled>true</IsEnabled>
<SourceLoc>Home</SourceLoc>
</MediaRecord>
<MediaRecord>
<MediaType>Playlist</MediaType>
<IsEnabled>true</IsEnabled>
<SourceLoc>Home+iTunes+WMP</SourceLoc>
</MediaRecord>
<MediaRecord>
<MediaType>Video</MediaType>
<IsEnabled>true</IsEnabled>
<SourceLoc>Home</SourceLoc>
</MediaRecord>
</MSS_MC_ClientConfig>
That is a very basic configuration with no custom paths. Since I can add partial custom paths using Console tool, I checked it again after adding as much of a custom path as I could. Now we can observe how the custom paths are represented.
<?xml version="1.0"?>
<MSS_MC_ClientConfig>
<Version>3.0.1</Version>
<ClientName>superfortress</ClientName>
<MediaRecord>
<MediaType>Photo</MediaType>
<IsEnabled>true</IsEnabled>
<SourceLoc>Home</SourceLoc>
</MediaRecord>
<MediaRecord>
<MediaType>PhotoVideo</MediaType>
<IsEnabled>true</IsEnabled>
<SourceLoc>Home</SourceLoc>
</MediaRecord>
<MediaRecord>
<MediaType>Music</MediaType>
<IsEnabled>true</IsEnabled>
<SourceLoc>Home+iTunes+WMP+Custom</SourceLoc>
<CustomLoc>L:\</CustomLoc>
</MediaRecord>
<MediaRecord>
<MediaType>AlbumArt</MediaType>
<IsEnabled>true</IsEnabled>
<SourceLoc>Home</SourceLoc>
</MediaRecord>
<MediaRecord>
<MediaType>Playlist</MediaType>
<IsEnabled>true</IsEnabled>
<SourceLoc>Home+iTunes+WMP+Custom</SourceLoc>
<CustomLoc>L:\</CustomLoc>
</MediaRecord>
<MediaRecord>
<MediaType>Video</MediaType>
<IsEnabled>true</IsEnabled>
<SourceLoc>Home</SourceLoc>
</MediaRecord>
</MSS_MC_ClientConfig>

We're going to edit the CustomLoc elements in the XML and make them point where we want.
7. Use the Administrative Tools:Services panel to stop the HPMediaSmartService (HPmssService.exe process).
If you don't stop the HPMediaSmartService, it may lock the database at inconvenient times.

8. Save a copy of your "mssdb.db" file. This will make it easy to start over if you need to.

9. In order to edit the existing XML configuration for your client you can copy and paste it into WordPad or NotePad, but you'll have to edit out the spurious newlines. Or you can use the ".output" command in SQLite to redirect to a file first.
I recommend using .output and just saving to a file -- I lost 30 minutes finding out I had accidentally deleted a "<" character while merging lines. I recommend you not try to pretty print it or break the lines for readability -- you should be editing a single block of text with no line breaks, same as what it was.
10. Edit the XML and update the database. In this example I edited it by changing the custom location to "L:\Audio\My Music\" (in two places). Your basic SQL command is this:
REPLACE INTO McConfig VALUES ('your client name', 'blob of xml');
You'll be inserting the name of your own client of course. We use single-quotes because there are double-quotes in the XML.
Hint: Construct the whole SQL command in the editor so you can just paste the whole thing into SQLite.
Note: Despite what you may see here, there should be no line breaks in the whole block of XML text.
sqlite>  REPLACE INTO McConfig VALUES ("superfortress",
'<?xml version="1.0"?><MSS_MC_ClientConfig><Version>3.0.1</Version><ClientName
>superfortress</ClientName><MediaRecord><MediaType>Photo</M
ediaType><IsEnabled>true</IsEnabled><SourceLoc>Home</SourceL
oc></MediaRecord><MediaRecord><MediaType>PhotoVideo</MediaTy
pe><IsEnabled>true</IsEnabled><SourceLoc>Home</SourceLoc>
</MediaRecord><MediaRecord><MediaType>Music</M
ediaType><IsEnabled>true</IsEnabled><SourceLoc>Home+iTunes+WMP+C
ustom</SourceLoc>
<CustomLoc>L:\Audio\My Music\</CustomLoc>
</MediaRecord><MediaRecord><MediaType>AlbumArt</MediaType>
<IsEnabled>true</IsEnabled><SourceLoc>Home</SourceLoc></Me
diaRecord><MediaRecord><MediaType>Playlist</Media
Type><IsEnabled>true</IsEnabled><SourceLoc>Home+iTunes+WMP+Cust
om</SourceLoc>
<CustomLoc>L:\Audio\My Music\</CustomLoc>
</MediaRecord><MediaRecord><MediaType>Video</MediaType><Is
Enabled>true</IsEnabled><SourceLoc>Home</SourceLoc></MediaRe
cord></MSS_MC_ClientConfig>');

Before moving on, check to see that your changes were accepted. This probably isn't necessary, but it will help you feel that you have accomplished something.
sqlite> SELECT * FROM McConfig WHERE target = "superfortress";

11. Sorry, but you're not done yet. You may have noticed that your client configuration also appears in the record for target=%Global% record, so we need to repeat steps 6-10 for that record. Here's what to do:
(a) Capture the existing XML for target="%Global%". Your command is similar to step 6:
sqlite> select ConfigXml from McConfig where target = "%Global%";
Use .output or Copy/Paste to capture the XML and edit the CustomLoc elements.

(b) Edit and update the %Global% entry. Your command is similar to step 10:
sqlite> REPLACE INTO McConfig VALUES ("%Global%", 'blob of XML');
(c) Check your results.
sqlite> SELECT * FROM McConfig WHERE target = "%Global%";
12. Now restart the HPMediaSmartService and check for errors.
Check the Event Viewer:Application log. If you made a mistake in the XML it will be reported there. (Hint: the Event Viewer is found under All Programs::Administrative Tools).

Use the WHS console to check the HP Media Collector status and configuration. You should see your new custom paths show up in the client configuration.
Good luck!

4 comments:

bolly said...

Hi Chip,

great posting. Works as described flawlessly.

It is a shame that HP is not able or willing to fix this problem.

Chip Chapin (H) said...

Hooray! Thanks for leaving the comment, Bolly, I'm happy that someone else found this useful.

I'm very disappointed in HP's apparent abandonment of this product. It has such great promise.

Ben Sporl said...

Thanks for the detailed write-up, saved my butt. I was about to uninstall the entire thing.

Meghana Naidu said...

I have read so many posts concerning the blogger lovers except this post is actually a fastidious article, keep it up. Chip Level Training in Hyderabad