I have hundreds of films recorded off the TV and a fair few movies on DVD. This makes finding and viewing TV programs and series slow and cluttered. I needed a solution that would allow these films to all appear in (and only in) the “Movies” browser and hopefully allow me to fetch missing meta-data. This needed to work on media centre extenders as I have this kit:
1 Custom built PC with 3TB of storage, 3 DVBT tuners, Windows 74 Linksys DMA2100 extenders (latest firmware)
This setup means I don’t have to worry about the noise of the main PC and I get the flexibility to watch recorded programs and listen to music anywhere I might want to in the house relatively inexpensively. It is fairly common for us to start watching something in the kitchen while clearing up after our evening meal and then finish watching it in the lounge (so the resume feature is great).
It turns out this is a bit of a mission to accomplish.
For the impatient and tech savvy you could just download this: http://andy.boura.co.uk/downloads/MoveRecordedTvMovies.exe and this:http://babgvant.com/files/folders/misc/entry5687.aspx (run without parameters for some basic help) and figure the rest out yourself in order to accomplish the TV movies bit...alternatively read on below…
Challenge 1: DVD playback on extenders
After a fair bit of digging I came up with the following solution:
- Rip the DVD or bypass the copy protection (if your countries legal system allows)
Free option: DVD Shrink – works very well
- check the checksum when you download as the downloads not available from the central location
- http://www.dvdshrink.org/what_en.php
Commercial option: AnyDVD (HD):- works very well
- works at the device driver level so can simplify workflow of other programs
- expensive with lifetime licence costing 109 euro
- http://www.slysoft.com/en/anydvdhd.html - Create a folder with the name and year of release of the film you are copying
- Create a dvr-ms version of the DVD in this folder
Free option: DVRMS Toolbox (toDVRMS etc…)
- a bit of a learning curve to get it working
- I didn’t have time to fully figure it out (joining VOBS for example) but perhaps you do….
- http://babgvant.com/files/folders/dvrmstoolbox/default.aspx
Commercial option: VideoRedo
- works well and is easy to use
- in conjunction with AnyDVD can do a single stage conversion
- Fairly expensive at $75
- http://www.videoredo.com - Get the meta data for the filmThere are several free options here. They each work somewhat differently so it’s probably worth you experimenting a bit and deciding which you like best:
- My Movies: http://www.mymovies.dk/
- Yammm: http://thegreenbutton.com/forums/p/73390/359121.aspx
- DVD Library Manager: http://thegreenbutton.com/forums/p/73390/359121.aspx
Personally I found My Movies to have the most complete movie information and although some of the features require a purchase of points or contribution of meta data I believe the free version is sufficient for the basic meta data retrieval. I haven’t yet figured out how to correct things if it’s decided on the wrong version of a particular film… - At this point my DVD (without interactive features and menus!) is available on my PC and extenders via the “Movies” section of Windows 7 media center and also through the “My Movies” plug-in. If you want interactive DVD menus you can only do it on the PC not the extenders but I did get this working:
- DVD image using DVDShrink into a folder called DVD Movies
-- Make this folder available in Media Center’s library
- Follow process as above called DVD Movies (transcoded)
-- Add this folder on the extenders but not the PC
I messed about with the various real-time transcoders but found it unreliable and certain functionality like resume and moving about within the film was either temperamental or not supported. I also realised that life’s too short for the extra features and waiting for menus anyway – I’d rather just play the movie!
I’m also not bothered about the MS format lock-in thing – there’s plenty of command line tools will convert dvr-ms into more open standards so I just set it going for however long it takes if / when the need arises. In the mean time I’ll have a working system thank you…
Challenge 2: Getting Recorded TV Movies to appear in (and only in) my “Movies” section (and update / correct meta data as required)
I was sure someone would have solved this but I looked everywhere and only found people with the problem and not the solution! Having managed to get my dvr-ms version of DVDs to show up in my movies (and not recorded tv / videos) I was sure it could be done. From reading on the forums (theGreenButton in particular) I had determined that TV movies have a meta data flag identifying them as such so that Media Center knows to give them special treatment. I found a meta data viewer / editor that allowed me to peak at the various fields available / used ( http://blogs.msdn.com/toub/archive/2005/05/12/416874.aspx ).
I then started looking for a command line program that would allow me to write a simple batch file to move the correct dvr-ms / wtv files into a “TV Movies” folder, and create appropriately named container folders for the fetching of meta data. I hunted around a bit at found a few bits but nothing looked particularly simple but I did come across the dvrms.dll ( http://babgvant.com/files/folders/misc/entry5687.aspx ). This would allow me to programmatically access the fields I require and create the appropriate folders automatically. So I dusted of visual studio and set to work…there’s various bits of bootstrap and paraphernalia around it but the core of the program is pretty simple. I don’t expect it will win any awards for pretty code but I it suits my needs (feel free to skip passed if code isn’t your thing!). The complete source code snippet is below and should serve as an example of how to do this stuff – just create a C# command line project to stick it in:
1: using System;
2: using System.Collections.Generic;
3: using System.Linq;
4: using System.Text;
5: using System.IO;
6:
7: using Toub.MediaCenter.Dvrms.Metadata;
8:
9: namespace MoveRecordedTVMovies
10: {
11: class Program
12: {
13: static void Main(string[] args)
14: {
15: DirectoryInfo inDir, outDir;
16: List<FileInfo> files = new List<FileInfo>();
17:
18: if (args.Length < 2)
19: {
20: Console.WriteLine("RecordedTvMovies <source folder> <target folder> [pause]");
21: Console.WriteLine("<source folder>:\nThe folder to find the .wtv and .dvr-ms files in (normally this will be your Recorded TV folder)\n");
22: Console.WriteLine("<target folder>:\nThe folder to create the individual movie folders in\n");
23: Console.WriteLine("[pause]: \nEnter without square brackets to cause execution to halt until you press a key on error");
24: Console.ReadKey();
25: return;
26: }
27:
28: bool pauseOnError = (args.Length > 2) ? args[2] == "pause" : false;
29:
30: try
31: {
32: inDir = new DirectoryInfo(args[0]);
33: outDir = new DirectoryInfo(args[1]);
34:
35: files.AddRange(inDir.GetFiles("*.wtv"));
36: files.AddRange(inDir.GetFiles("*.dvr-ms"));
37: }
38: catch(Exception ex)
39: {
40: Console.WriteLine("Couldn't open folder: " + args[0]);
41: Console.WriteLine(ex);
42: if (pauseOnError) Console.ReadKey();
43: return;
44: }
45:
46: Console.WriteLine("Found " + files.Count.ToString() + " .wtv and .dvr-ms files");
47:
48: foreach(FileInfo fi in files)
49: {
50: try
51: {
52: using (DvrmsMetadataEditor ed = new Toub.MediaCenter.Dvrms.Metadata.DvrmsMetadataEditor(fi.FullName))
53: {
54: bool isMovie = GetMeta(ed, "WM/MediaIsMovie") == "True";
55: Console.WriteLine(isMovie.ToString() + ": " + GetMeta(ed, "Title") + " (" + GetMeta(ed, "WM/OriginalReleaseTime") + ")");
56:
57: if (isMovie)
58: {
59: try
60: {
61: DirectoryInfo movieDir = outDir.CreateSubdirectory(MovieFolderName(ed));
62: fi.MoveTo(movieDir.FullName + "/" + fi.Name);
63: }
64: catch (Exception ex)
65: {
66: Console.WriteLine("Couldn't create folder and move movie: " + MovieFolderName(ed) + "/" + fi.Name);
67: Console.WriteLine(ex);
68: if(pauseOnError) Console.ReadKey();
69: }
70: }
71: }
72: }
73: catch (Exception ex)
74: {
75: Console.WriteLine("Couldn't access meta data for: " + fi.Name);
76: Console.WriteLine(ex);
77: if (pauseOnError) Console.ReadKey();
78: }
79: }
80: }
81:
82: static string GetMeta(Toub.MediaCenter.Dvrms.Metadata.DvrmsMetadataEditor ed, string metaKey)
83: {
84: return DvrmsMetadataEditor.GetMetadataItemAsString(ed.GetAttributes(), metaKey);
85: }
86:
87: static string MovieFolderName(DvrmsMetadataEditor ed)
88: {
89: string date = GetMeta(ed, "WM/OriginalReleaseTime");
90: int hyphen = date.IndexOf("-");
91: if (hyphen > 0) date = date.Substring(0, hyphen);
92: return GetMeta(ed, "Title").Replace(':', ';') + " (" + date + ")";
93: }
94: }
95: }
(Download source code here: http://andy.boura.co.uk/downloads/Program.cs.txt [remove.txt to compile] )
This dealt with the 300+ TV movies I had in a mixture of .wtv and .dvr-ms formats. The odd one didn’t have the date set correctly etc. but generally speaking it works well.
--- IF YOU STOPPED READING WHEN I SHOWED CODE START READING AGAIN NOW ---
You can download the command line program here:
http://andy.boura.co.uk/downloads/MoveRecordedTvMovies.exe
http://andy.boura.co.uk/downloads/MoveRecordedTvMovies.exe
You will need the latest .net framework from MS and the dvrms.dll from here:
http://babgvant.com/files/folders/misc/entry5687.aspx
http://babgvant.com/files/folders/misc/entry5687.aspx
Using it is simple - I use this batch file:
1: MoveRecordedTvMovies "B:\Recorded TV" "B:\TV Movies" pause
2: MoveRecordedTvMovies "C:\Users\Public\Recorded TV" "C:\Users\Public\Public TV Movies" pause
3: pause
(Download batch file here: http://andy.boura.co.uk/downloads/MoveMovies.bat.txt [remove.txt to run] ) )
Once you are happy it’s working as you require you may want to add it as a scheduled task within windows (if doing that you will probably want to remove line 3 from the batch file or you will have to manually close the batch file output each day…).
Final Thoughts and observations
- This really shouldn’t have been so difficult if MS put just a bit more effort into Media Center…that said it’s much improved in Win 7.
- Someone could write a plug-in for media center extenders that gave full interactive DVD menus if they had the know-how…I would pay a small premium for such a plug-in if anyone fancies writing it – and I’m sure many others would too…
- I have found the built in Movies library to be a bit slow and sometimes get confused regarding loading the meta data and thumbnails from the folders. For this reason I’ve been tending to use the My Movies interface. That said unfortunately My Movies doesn’t support resume! I might hunt for another option…
Anyway, that’s all for now – bit of an essay in the end I’m afraid :) Hope you find it useful – if you did please leave a comment and other positive encouragement so I know it’s worth writing this sort of thing up in future as it does take quite a while!
Cheers
Andy
Andy
Nice job, Andy. Wasn't ALL exactly what I was looking for, but even so, you ought to have some praise for your effort! Cheers back atcha, sir.
ReplyDeleteWow, this was EXACTLY what I was looking for. I really do appreciate what you have done, Andy, thank you!
ReplyDeleteBut I do have a little problem... Most of the folders created have the year (0) added. I use Media Browser for automatic metadata retrieval and it cannot find anything with "[Title] (0)". I have to change the name manually, and that's no fun...
Is it possible for you to add a few lines in your code so it doesn't add the year in folder names if the year field is empty/zero?
Thanks in advance!