Change where recordings show up - Recorded TV vs Movies

richard1980

Posts: 2623
Joined: Wed Jun 08, 2011 3:15 am
Location:

HTPC Specs: Show details

#21

Post by richard1980 » Sat Jan 05, 2013 12:45 pm

To be fair, it's not my program. I just happen to know how to use it.

.Nico

Posts: 111
Joined: Fri Jun 10, 2011 9:59 am
Location: Maarssen - the Netherlands

HTPC Specs: Show details

#22

Post by .Nico » Sat Jan 05, 2013 1:07 pm

richard1980 wrote:That registry edit does not accomplish the correct goal. Setting the value to 1 prevents movies recorded in WMC from appearing in the movie library. Setting it to 0 results in movies recorded in WMC will appear in the movie library, which is the default behavior anyway. Neither of the possible values accomplish the goal of having the movies only appear in the movie library but not appear in the recorded TV library, which is what this thread is discussing. The only way to accomplish that goal is to move the file out of the recorded TV folder and into a separate folder that is part of the movie library but is not part of the recorded TV library.
Ok, sorry, just missed that last part :?

th3Pil0t

Posts: 87
Joined: Fri Jan 18, 2013 5:59 pm
Location:

HTPC Specs: Show details

#23

Post by th3Pil0t » Sun Aug 04, 2013 11:20 pm

A huge thankyou for posting the solution to this. I finally got sick of dealing with a huge recorded TV list and have setup the tasks to move the movies as well at rename and move the TV episodes. Brilliant and thanks again! :clap:

ruff_hi

Posts: 79
Joined: Sun Nov 02, 2014 6:24 pm
Location:

HTPC Specs: Show details

#24

Post by ruff_hi » Tue Jan 13, 2015 1:03 am

I've started to use the 'MoveRecordedTvMovies' exe and it works like a treat. However, I can do without the '(YYYY)' on the end of the directory name. Is that an optional parameter that I can use? Or has someone got the source code that I can modify?

richard1980

Posts: 2623
Joined: Wed Jun 08, 2011 3:15 am
Location:

HTPC Specs: Show details

#25

Post by richard1980 » Wed Jan 14, 2015 12:20 am

Code: Select all

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using Toub.MediaCenter.Dvrms.Metadata;

namespace MoveRecordedTVMovies
{
    class Program
    {
        static void Main(string[] args)
        {
            DirectoryInfo inDir, outDir;
            List<FileInfo> files = new List<FileInfo>();

            if (args.Length < 2)
            {
                Console.WriteLine("RecordedTvMovies <source folder> <target folder> [pause]");
                Console.WriteLine("<source folder>:\nThe folder to find the .wtv and .dvr-ms files in (normally this will be your Recorded TV folder)\n");
                Console.WriteLine("<target folder>:\nThe folder to create the individual movie folders in\n");
                Console.WriteLine("[pause]: \nEnter without square brackets to cause execution to halt until you press a key on error");
                Console.ReadKey();
                return;
            }

            bool pauseOnError = (args.Length > 2) ? args[2] == "pause" : false;

            try
            {
                inDir = new DirectoryInfo(args[0]);
                outDir = new DirectoryInfo(args[1]);

                files.AddRange(inDir.GetFiles("*.wtv"));
                files.AddRange(inDir.GetFiles("*.dvr-ms"));
            }
            catch(Exception ex)
            {
                Console.WriteLine("Couldn't open folder: " + args[0]);
                Console.WriteLine(ex);
                if (pauseOnError) Console.ReadKey();
                return;
            }

            Console.WriteLine("Found " + files.Count.ToString() + " .wtv and .dvr-ms files");

            foreach(FileInfo fi in files)
            {
                try
                {
                    using (DvrmsMetadataEditor ed = new Toub.MediaCenter.Dvrms.Metadata.DvrmsMetadataEditor(fi.FullName))
                    {
                        bool isMovie = GetMeta(ed, "WM/MediaIsMovie") == "True";
                        Console.WriteLine(isMovie.ToString() + ": " + GetMeta(ed, "Title") + " (" + GetMeta(ed, "WM/OriginalReleaseTime") + ")");

                        if (isMovie)
                        {
                            try
                            {
                                DirectoryInfo movieDir = outDir.CreateSubdirectory(MovieFolderName(ed));
                                fi.MoveTo(movieDir.FullName + "/" + fi.Name);
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("Couldn't create folder and move movie: " + MovieFolderName(ed) + "/" + fi.Name);
                                Console.WriteLine(ex);
                                if(pauseOnError) Console.ReadKey();
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Couldn't access meta data for: " + fi.Name);
                    Console.WriteLine(ex);
                    if (pauseOnError) Console.ReadKey();
                }
            }
       }

        static string GetMeta(Toub.MediaCenter.Dvrms.Metadata.DvrmsMetadataEditor ed, string metaKey)
        { 
            return DvrmsMetadataEditor.GetMetadataItemAsString(ed.GetAttributes(), metaKey);
        }

        static string MovieFolderName(DvrmsMetadataEditor ed)
        {
            string date = GetMeta(ed, "WM/OriginalReleaseTime");
            int hyphen = date.IndexOf("-");
            if (hyphen > 0) date = date.Substring(0, hyphen);
            return GetMeta(ed, "Title").Replace(':', ';') + " (" + date + ")";
        }
    }
}

ruff_hi

Posts: 79
Joined: Sun Nov 02, 2014 6:24 pm
Location:

HTPC Specs: Show details

#26

Post by ruff_hi » Wed Jan 14, 2015 1:19 pm

Excellent. Thankyou. I am pretty sure that I can mod this code to get it to do what I want.

However ... how do I get it compiled? I have visual studio 2005 installed on my PC ... but only the VB templates. I guess I could dig out the installation CDs and add C++ ... but is there an easier way? Or am I missing something here?

richard1980

Posts: 2623
Joined: Wed Jun 08, 2011 3:15 am
Location:

HTPC Specs: Show details

#27

Post by richard1980 » Thu Jan 15, 2015 12:31 am

That's C#, not C++. So you'll need to install C#, then just create a new command line project and drop the code above into it, add the appropriate references to the project, and compile. I assume you already have Toub.MediaCenter.Dvrms.dll, but if not I have attached it.
Attachments
New Compressed (zipped) Folder.zip
(54.35 KiB) Downloaded 40 times

ruff_hi

Posts: 79
Joined: Sun Nov 02, 2014 6:24 pm
Location:

HTPC Specs: Show details

#28

Post by ruff_hi » Thu Jan 15, 2015 1:47 am

Thanks for the heads up. Looks like I will still have to find those VS2005 install disks. I'll leave that for the weekend.

Post Reply