AVS Forum banner

1 - 6 of 6 Posts

·
Registered
Joined
·
4,641 Posts
Discussion Starter · #1 ·
Given that this question comes up on a fairly regular basis, I thought I'd do a quick tutorial on this. It's really quite easy. This is one of those small things that just makes life easier, one less thing to worry about.
To a lot of folks, this may be trivial and immaterial, but it might help other folks that are just getting into Media Center and trying to set up NAS based storage for their recordings.
  • The tutorial is written for Vista, I'll try and do one for XP later, although you should be able to adapt this as easily.
  • The tutorial assumes you have read/write priveleges to the destination location.


What we are going to use is, the built in Task Scheduler in Vista to schedule a task that moves files to your selected destination. All it requires is a small .bat file as the script that needs to be executed, and the right settings in the Task Scheduler.


The .bat file looks like this:

Quote:
ECHO OFF

copy "c:\\users\\public\

ecorded tv\\*.dvr-ms" "Your target location" /Y

del "c:\\users\\public\

ecorded tv\\*.dvr-ms"

Just copy this code, paste it into notepad and save it as a .bat file (you can name it anything) somewhere on your local drive on the Media Center PC. I just save it to C:\\


Make sure you change the path of the source files, if it's something else (it shouldn't by default, unless you modified registry settings in Media Center to record somewhere else).


Put your target destination folder by replacing "Your target location" with the actual path. For e.g. \\\\server\

ecorded TV\\


The double quotes are important, if you have any spaces in your path (which you probably will).


Next, fire up the Task Scheduler. Right click, the "Computer" icon on the desktop and select "Manage", or go into Control Panel --> Administrative Tools and select Task Scheduler.




Next, right click the "Task Scheduler" entry and select "Create Task"




In the "Name" field, give the task a meaningful name. Anything wil suffice, but something meaningful is helpful for future reference. I usually name it "Move Media Center Recordings automatically"


In the "Description" field, give it some description, if you want. It's not required.


Under Security Options:


- Make sure you are logged in as the user that your HTPC logs in as when it's running Media Center and doing recordings.

- Make sure you select "Run whether user is logged on or not" and "Run with highest priveleges". (The latter is not required per se, but depending on your Network security settings, it may be useful. I usually select it, it doesn't do any harm.

- Keep the default "Configure for" as "Windows Vista or Server 2008"




Next, click the "Triggers" tab. This is where we'll define WHEN this task should be activated and run. We are going to use two Media Center events that it logs to the Windows log (Which the Task Scheduler can use).


The events IDs are "1" and "3". As far as I have seen:


- Event ID 1 corresponds to a scheduled recording, and Media Center logs this event AFTER it has successfully finished a scheduled recording.

- Event ID 3 corresponds to a "manual" recording i.e. you hit the "Record" button at some point, and either told Media Center to stop recording at a point after that, or the program finished.




Go ahead and click the "New" button to define a new trigger.





In the "Begin the task" drop down, select "On an event".

In the "Settings" section, choose the following settings:


- Log - Media Center

- Source - Recordings

- Event ID - 1


In the "Advanced Settings", select the check box that says "Delay task for" and select a duration. This will delay the execution of your task, by the selected duration. I typically use 1 minute as the delay, to make sure you don't start a high speed file copy, right when Media Center might be switching tuners for your HDHR on the network or something similar.
You can play with this setting and fine tune it for what suits your envrionment best.




Click OK on the new trigger wizard




Repeat the same steps to define a second trigger, with the exact same settings, but use Event ID 3 this time.




Next, click the Actions tab. This is where we'll define WHAT should the computer do, when these events happen. This is where we'll point the computer to the .bat file we created earlier.




Go ahead and click "New" to create a new action. The default action is "start a program", leave it at that. In the settings section, hit the Browse button and point it to the .bat file we created earlier.




Click OK




That's it! There are additional settings in the "Conditions" and "Settings" tabs, but the defaults work just fine. You can further fine tune things if you want, by changing some things in those tabs.


Click OK, finally, and your task should be set.


To test, fire up Media Center, tune to any channel, hit the record button, let it run for a few seconds, and then hit Stop Recording. Go check your target storage location to see if the recording was moved successfully. If you have also configured your Media Center to "watch" that location (which you should be doing), then the recording will appear in your "recorded TV" in Media Center. If you have multiple HTPCs that access this same storage location for recordings, the recording will appear on all of them.

Quirks: Media Center uses a very aggressive locking mechanism on the files it creates and releases these locks only when you switch channels. So, even after the script fires and your recording has been moved, if you go to c:\\users\\public\

ecorded TV, you'll probably STILL see the recording there. Don't worry, the recording has been moved as such, the "delete" file command has executed and is just waiting for MC to release the file lock. As soon as you switch to a different channel or hit Stop on your remote OR after a certain amount of time (that only Media Center knows) the files will disappear and will be physically deleted automatically.


Enjoy.
 

·
Registered
Joined
·
481 Posts
If I have two media centers, can I not have both the media centers to write to the same folder on the NAS and show up on both Media Centers' Recorded TV?
 

·
Registered
Joined
·
516 Posts
I've just found a problem with this


Program 1 Recording on Channel 5 from 20:00 to 21:00

Program 2 Recording on Channel 14 from 20:30 to 21:00

Program 3 Recording on Channel 1 from 21:00 to 22:00


The card in my PC is a twin tuner and programs record with 2 mins before and 5 min after if possible. At 21:06 the TV recordings are moved to the WHS box including the truncated recording of Program 3. When the program finishes recording a 22:00 it is deleted from the local disc and the only version on the network is the truncated version.


Yikes!
 

·
Registered
Joined
·
492 Posts
First use the move command not the copy/del. Second I'm almost *CERTAIN* the move command will check for space availability and fail if it doesn't work.


You can also install Slawdog Smart Shutdown and run this over night (like 4am) and set the HTPC to sleep immediately afterward.. 'course if you have video issues after resuming, this could be a nuissance later?
 

·
Registered
Joined
·
262 Posts
I just came across this thread as I'd like to move recorded TV from both of my HTPCs nightly onto my new server. I was wondering if salacious' concern has been addressed. I have programs recording almost constantly from at least one tuner (I have 6 total between the two machines), and I want to make sure that if a file is in use, it's not moved or deleted, and I definitely do not want to move or copy partial programs. I do not have much experience with scripting, so I hope this is not a stupid question.


Thanks,

Chris
 
1 - 6 of 6 Posts
Top