Jan
30
2008
0

Two MediaPortal tips

Get it to manage your power

If like me you use MediaPortal on your primary machine, you may not want to keep your computer on all the time but still want to record your favourite TV shows. Start up the TV Server Configuration and activate the Power Manager plugin. Tell it how many seconds you want your computer to start before a recording, and how many minutes afterwards (so long as there is no inactivity). Turn off the Windows power management from the Control Panel. Now just before a recording your computer will start up and after it records it’ll wait a little while and turn off again. If you start to use the machine, it won’t turn off and if you have MediaPortal playing something it won’t unexpectedly shut down your computer.

When your TV is hooked up to your graphics card

[nVidia tip] I have a TV hooked up to my machine but it is at a completely different resolution (720p) to my main monitor. While I extend the desktop using nViews DualView mode, I only ever use the TV when running MediaPortal so have no need for my graphics card to render that when I don’t need to. The simple way to change this is to right click the nVidia icon on your system tray, go to nView Display Settings, Single display and then your main desktop. To switch back, you do the same but instead go to DualView and then to your monitor setup.

Of course, that is a number of clicks and no self respecting geek wants to waste valuable clicks. nView allows you to change it via the commandline.

rundll32.exe nvcpl.dll,dtcfg setview [attached monitor #] [format] [device]

So to go into single display
rundll32.exe nvcpl.dll,dtcfg setview 1 standard DA

And to go into DualView
rundll32.exe nvcpl.dll,dtcfg setview 1 dualview DA AA

Those DA and AA means Digital or Analog and then A, B, C, etc for your 1st, 2nd, 3rd, etc monitor. Remember, even if your graphics card has two digital outputs, if you put a VGA (analog) adapter on it is going to consider it an analog connection.

You can script this in a .bat file and put them somewhere so you click one before loading MediaPortal and click the other afterwards. Because I didn’t want a DOS prompt, I used the Process and ProcessStartInfo objects in .Net with C# to run the DualView command, wait a second (for the monitors to be happy), load up MediaPortal, wait for it to exit, and then run the Single display code. If you click the More link below, you’ll get that code.

For full details see forum post. (Tip was found via Cuttlefish Industries).

And seeming you wanted it, here’s the code (C# 2.0).

Process procRun = new Process();

// Create a ProcessStartInfo to start rundll32
// and set its initial parameters
// Assign it to procRun, start it, then wait a second and a bit
ProcessStartInfo procRunDll = new ProcessStartInfo("rundll32.exe", "nvcpl.dll,dtcfg setview 1 dualview DA AA");
procRun.StartInfo = procRunDll;
procRun.Start();
System.Threading.Thread.Sleep(1500);

// Create a ProcessStartInfo for MediaPortal
// Assign it to procRun, start it and wait for it to finish
// Wait half a second afterwards
ProcessStartInfo procRunMP = new ProcessStartInfo("C:\\Program Files\\Team MediaPortal\\MediaPortal\\MediaPortal.exe");
procRun.StartInfo = procRunMP;
procRun.Start();
procRun.WaitForExit();
System.Threading.Thread.Sleep(500);

// Change the arguments to procRunDll
// Reassign back to procRun, start it
// then exit the application
procRunDll.Arguments = "nvcpl.dll,dtcfg setview 1 standard DA";
procRun.StartInfo = procRunDll;
procRun.Start();
Application.Exit();

No Comments

No comments yet.

Leave a comment