Moving recorded TV based on record date?

Post Reply
exodus454

Posts: 11
Joined: Tue Feb 05, 2013 6:15 am
Location:

HTPC Specs: Show details

Moving recorded TV based on record date?

#1

Post by exodus454 » Thu Feb 14, 2013 11:56 pm

So I'm having an issue here.. I want to be able to move recorded files off of my 1tb drive and onto a 2tb drive after they haven't been watched for a certain amount of time. I want to be able to have the 1tb as a "live recordings" drive, and then move unwatched recordings into an "archive".

I tried doing it with robocopy and similar methods, I can't find any batch or script method to move files based off of the date created, only access time and date modified. WMC's library scanner or something is also going through ALL the files and changing the access and modified parameters of the files so I can't use that reliably. Some recorded shows that have been around for months and never watched have last modified times of 2/13 so robocopy will leave them where they are. I haven't come up with any way to be able to move them based off date created, which I find hard to believe.

I was also thinking about using the metadata in the WTV files, but I really have NO idea how to implement that. There is a "recording time" field that WMC uses but I'm not how to user it to do what I need. Either that, or change the NTFS permissions for the media center user that handles the media library scanning and remove the write permissions on that folder. I don't know what user that is, so that might take some research.

Ideally I'd like to have Windows scheduler handle the script/move and have it run maybe once or twice a week.

Anyone have any good ideas of how to implement this??

foxwood

Posts: 1761
Joined: Fri Sep 07, 2012 3:43 pm
Location:

HTPC Specs: Show details

#2

Post by foxwood » Fri Feb 15, 2013 12:36 am

I gave an example of using the Extended Properties of a WTV file from VBScript in this post: http://www.thegreenbutton.tv/forums/vie ... 395#p39395

The particular property that I was interested in was Parental Guidance, which is number 227 (in Windows 7 - the numbers are different in different versions of Windows!). I have a code snippet somewhere that you can run to list the Extended Properties, so that you can figure out which field you want to copy against before starting your copy. I'll see if I can track it down and post it later.

foxwood

Posts: 1761
Joined: Fri Sep 07, 2012 3:43 pm
Location:

HTPC Specs: Show details

#3

Post by foxwood » Fri Feb 15, 2013 4:03 am

The property for "Recording Time" is 260 in Windows 7. I'll try to post a code snippet tomorrow.

exodus454

Posts: 11
Joined: Tue Feb 05, 2013 6:15 am
Location:

HTPC Specs: Show details

#4

Post by exodus454 » Fri Feb 15, 2013 5:47 am

That'd be great if you could. I took a look at the VBscript you posted and while I can pick some stuff out of it, I don't really understand what it's doing.

foxwood

Posts: 1761
Joined: Fri Sep 07, 2012 3:43 pm
Location:

HTPC Specs: Show details

#5

Post by foxwood » Fri Feb 15, 2013 6:09 pm

If you save this script as RecordedTVAge.vbs, then open a command promt and run

CSCRIPT RecordedTVAge.vbs

it will list all the files in your Recorded TV folder that have a "Recording Time" attribute, and the number of days between that time and Now. ("Recording Time" isn't a file system attribute, it's an Extended Attribute that's part of the file itself).

Note that it skips files that are currently being recorded - the attribute is only written when the file is finished recording.

Code: Select all

'Run this script at a command prompt with   CSCRIPT RecordedTVAge.vbs

' Read recorded TV location and Recorded TV type from registry
Set WSHShell = CreateObject("WScript.Shell") 
RecordedTVPath = WSHShell.RegRead ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Service\Recording\RecordPath") 

Set objShell = CreateObject("Shell.Application") 
Set objFolder = objShell.Namespace(RecordedTVPath) 

'For Vista/Windows7, Extended Property #260 is "Recording Time", the time a recording was made
For Each strFileName in objFolder.Items 
  If objFolder.GetDetailsOf(strFileName, 260) <> "" then 
    strdate="" 
    rdate = objFolder.GetDetailsOf(strFileName, 260) 

' The "Recording Time" string contains some extraneous characters - this strips them out
    for x=1 to len(rdate) 
      if asc(mid(rdate,x,1)) <> 63 then strdate=strdate & mid(rdate,x,1) 
    next 

'Display the filename and how many days old it is.
    WScript.Echo objFolder.GetDetailsOf(strFileName, 0) & vbtab & datediff("d", cdate(strdate), now) 

  end if 
Next

foxwood

Posts: 1761
Joined: Fri Sep 07, 2012 3:43 pm
Location:

HTPC Specs: Show details

#6

Post by foxwood » Fri Feb 15, 2013 6:14 pm

Here's a list of the Extended Attributes in Vista/Win7:

Code: Select all

0 Name:
1 Size:
2 Item type:
3 Date modified:
4 Date created:
5 Date accessed:
6 Attributes: 
7 Offline status: 
8 Offline availability: 
9 Perceived type: 
10 Owner: 
11 Kind: 
12 Date taken: 
13 Contributing artists: 
14 Album: 
15 Year: 
16 Genre: 
17 Conductors: 
18 Tags: 
19 Rating: 
20 Authors: 
21 Title: 
22 Subject: 
23 Categories: 
24 Comments: 
25 Copyright: 
26 #: 
27 Length: 
28 Bit rate: 
29 Protected: 
30 Camera model: 
31 Dimensions: 
32 Camera maker: 
33 Company: 
34 File description: 
35 Program name: 
36 Duration: 
37 Is online: 
38 Is recurring: 
39 Location: 
40 Optional attendee addresses: 
41 Optional attendees: 
42 Organizer address: 
43 Organizer name: 
44 Reminder time: 
45 Required attendee addresses: 
46 Required attendees: 
47 Resources: 
48 Meeting status: 
49 Free/busy status: 
50 Total size: 
51 Account name: 
52 Task status: 
53 Computer: 
54 Anniversary: 
55 Assistant's name: 
56 Assistant's phone: 
57 Birthday: 
58 Business address: 
59 Business city: 
60 Business country/region: 
61 Business P.O. box: 
62 Business postal code: 
63 Business state or province: 
64 Business street: 
65 Business fax: 
66 Business home page: 
67 Business phone: 
68 Callback number: 
69 Car phone: 
70 Children: 
71 Company main phone: 
72 Department: 
73 E-mail address: 
74 E-mail2: 
75 E-mail3: 
76 E-mail list: 
77 E-mail display name: 
78 File as: 
79 First name: 
80 Full name: 
81 Gender: 
82 Given name: 
83 Hobbies: 
84 Home address: 
85 Home city: 
86 Home country/region: 
87 Home P.O. box: 
88 Home postal code: 
89 Home state or province: 
90 Home street: 
91 Home fax: 
92 Home phone: 
93 IM addresses: 
94 Initials: 
95 Job title: 
96 Label: 
97 Last name: 
98 Mailing address: 
99 Middle name: 
100 Cell phone: 
101 Nickname: 
102 Office location: 
103 Other address: 
104 Other city: 
105 Other country/region: 
106 Other P.O. box: 
107 Other postal code: 
108 Other state or province: 
109 Other street: 
110 Pager: 
111 Personal title: 
112 City: 
113 Country/region: 
114 P.O. box: 
115 Postal code: 
116 State or province: 
117 Street: 
118 Primary e-mail: 
119 Primary phone: 
120 Profession: 
121 Spouse/Partner: 
122 Suffix: 
123 TTY/TTD phone: 
124 Telex: 
125 Webpage: 
126 Content status: 
127 Content type: 
128 Date acquired: 
129 Date archived: 
130 Date completed: 
131 Device category: 
132 Connected: 
133 Discovery method: 
134 Friendly name: 
135 Local computer: 
136 Manufacturer: 
137 Model: 
138 Paired: 
139 Classification: 
140 Status: 
141 Client ID: 
142 Contributors: 
143 Content created: 
144 Last printed: 
145 Date last saved: 
146 Division: 
147 Document ID: 
148 Pages: 
149 Slides: 
150 Total editing time: 
151 Word count: 
152 Due date: 
153 End date: 
154 File count: 
155 Filename: 
156 File version: 
157 Flag color: 
158 Flag status: 
159 Space free: 
160 Bit depth: 
161 Horizontal resolution: 
162 Width: 
163 Vertical resolution: 
164 Height: 
165 Importance: 
166 Is attachment: 
167 Is deleted: 
168 Encryption status: 
169 Has flag: 
170 Is completed: 
171 Incomplete: 
172 Read status: 
173 Shared: No 
174 Creators: 
175 Date: 
176 Folder name: 
177 Folder path: 
178 Folder: 
179 Participants: 
180 Path: 
181 By location: 
182 Type: 
183 Contact names: 
184 Entry type: 
185 Language: 
186 Date visited: 
187 Description: 
188 Link status: 
189 Link target: 
190 URL: 
191 Media created: 
192 Date released:  
193 Encoded by: 
194 Producers: 
195 Publisher: 
196 Subtitle: 
197 User web URL: 
198 Writers: 
199 Attachments: 
200 Bcc addresses: 
201 Bcc: 
202 Cc addresses: 
203 Cc: 
204 Conversation ID: 
205 Date received: 
206 Date sent: 
207 From addresses: 
208 From: 
209 Has attachments: 
210 Sender address: 
211 Sender name: 
212 Store: 
213 To addresses: 
214 To do title: 
215 To: 
216 Mileage: 
217 Album artist: 
218 Album ID: 
219 Beats-per-minute: 
220 Composers: 
221 Initial key: 
222 Part of a compilation: 
223 Mood: 
224 Part of set: 
225 Period: 
226 Color: 
227 Parental rating: 
228 Parental rating reason: 
229 Space used: 
230 EXIF version: 
231 Event: 
232 Exposure bias: 
233 Exposure program: 
234 Exposure time: 
235 F-stop: 
236 Flash mode: 
237 Focal length: 
238 35mm focal length: 
239 ISO speed: 
240 Lens maker: 
241 Lens model: 
242 Light source: 
243 Max aperture: 
244 Metering mode: 
245 Orientation: 
246 People: 
247 Program mode: 
248 Saturation: 
249 Subject distance: 
250 White balance: 
251 Priority: 
252 Project: 
253 Channel number: 
254 Episode name: 
255 Closed captioning: 
256 Rerun: 
257 SAP: 
258 Broadcast date: 
259 Program description: 
260 Recording time: 
261 Station call sign: 
262 Station name: 
263 Summary: 
264 Snippets: 
265 Auto summary: 
266 Search ranking: 
267 Sensitivity: 
268 Shared with: 
269 Sharing status:
270 Product name: 
271 Product version: 
272 Support link: 
273 Source: 
274 Start date: 
275 Billing information: 
276 Complete: 
277 Task owner: 
278 Total file size: 
279 Legal trademarks: 
280 Video compression: 
281 Directors: 
282 Data rate: 
283 Frame height: 
284 Frame rate: 
285 Frame width: 
286 Total bitrate: 
287 Creator: 
288 Encryption Level: 
289 Content Accessibility: 
290 Document Assembly: 
291 Changing: 
292 Commenting: 
293 Copying: 
294 Form Filling: 
295 Printing: 
296 Producer: 
297 PDF Specification: 
298 Encrypted:

fjdrasch

Posts: 1
Joined: Sat Feb 16, 2013 2:49 pm
Location:

HTPC Specs: Show details

#7

Post by fjdrasch » Sat Feb 16, 2013 2:52 pm

Recorded TV Manager 3 will automatically Move recordings after a defined number of hours.

http://www.fjdrasch.com/v3/automove.htm

bobbob

Posts: 676
Joined: Wed Oct 26, 2011 11:21 am
Location:

HTPC Specs: Show details

#8

Post by bobbob » Mon Feb 18, 2013 8:35 am

another step entirely but you could look at wtv metarenamer http://wtvmetarenamer.codeplex.com/ its primary role is to rename wtv files based on their metadata to a format useful to MediaBrowser and similar but it has a switch to only move files after x number of days.

richard1980

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

HTPC Specs: Show details

#9

Post by richard1980 » Mon Feb 18, 2013 1:15 pm

fjdrasch wrote:Recorded TV Manager 3 will automatically Move recordings after a defined number of hours.
Can you please clarify something? The following is stated on the AutoMove web page:

"Each time AutoMove runs, it obtains a list of current recordings in the Recorded TV folder and searches that list from the beginning. The first eligible recording is moved (or copied) to the destination folder. Once the move is complete, the timer is reset. If there are no recordings, or no eligible recordings, then AutoMove does nothing and simply resets the timer."

I interpret that to mean only one file will be moved each time the timer expires. I see this as a major limitation that makes your software undesirable. A good solution would move all eligible files, not just one file. So can you please clarify whether your software only moves one file each time the timer expires, or does it move all eligible files? Additionally, what is the maximum value that may be set for the wait time? On your webpage, you have used 2 hours as an example. What if I wanted to use a much larger number, such as 168 hours (7 days)?

exodus454

Posts: 11
Joined: Tue Feb 05, 2013 6:15 am
Location:

HTPC Specs: Show details

#10

Post by exodus454 » Wed Feb 20, 2013 9:52 pm

foxwood wrote:If you save this script as RecordedTVAge.vbs, then open a command promt and run

CSCRIPT RecordedTVAge.vbs

it will list all the files in your Recorded TV folder that have a "Recording Time" attribute, and the number of days between that time and Now. ("Recording Time" isn't a file system attribute, it's an Extended Attribute that's part of the file itself).

Note that it skips files that are currently being recorded - the attribute is only written when the file is finished recording.

Code: Select all

'Run this script at a command prompt with   CSCRIPT RecordedTVAge.vbs

' Read recorded TV location and Recorded TV type from registry
Set WSHShell = CreateObject("WScript.Shell") 
RecordedTVPath = WSHShell.RegRead ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Service\Recording\RecordPath") 

Set objShell = CreateObject("Shell.Application") 
Set objFolder = objShell.Namespace(RecordedTVPath) 

'For Vista/Windows7, Extended Property #260 is "Recording Time", the time a recording was made
For Each strFileName in objFolder.Items 
  If objFolder.GetDetailsOf(strFileName, 260) <> "" then 
    strdate="" 
    rdate = objFolder.GetDetailsOf(strFileName, 260) 

' The "Recording Time" string contains some extraneous characters - this strips them out
    for x=1 to len(rdate) 
      if asc(mid(rdate,x,1)) <> 63 then strdate=strdate & mid(rdate,x,1) 
    next 

'Display the filename and how many days old it is.
    WScript.Echo objFolder.GetDetailsOf(strFileName, 0) & vbtab & datediff("d", cdate(strdate), now) 

  end if 
Next
Sorry, still haven't had a chance to play with this yet. Been busy with a bunch of other stuff.

So if this script gets a list of all files with their recorded age, how do I then pass off this information to robocopy or another program to handle the actual moving of the files?

foxwood

Posts: 1761
Joined: Fri Sep 07, 2012 3:43 pm
Location:

HTPC Specs: Show details

#11

Post by foxwood » Wed Feb 20, 2013 10:31 pm

You don't pass it to Robocopy - as far as I can tell, RoboCopy doesn't take a list of files as a parameter.

You could set the script to move the files into a temporary subdirectory on the first drive (pretty much instantaneous), and then have RoboCopy move the contents of that folder the 2nd drive, or you could just have the script call Robocopy on each file, or you could have the script do the move for you - if the drive is on the same system it's probably just as easy as having RoboCopy do it, though if your target is a network drive, maybe RoboCopy would be better.

Post Reply