NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 63 64 65 66 67 … 93 Next »
Automatic purging of recordings

 
  • 0 Vote(s) - 0 Average
Automatic purging of recordings
erik
Offline

Posting Freak

Posts: 1,138
Threads: 123
Joined: Apr 2005
#1
2005-12-16, 12:12 PM
I am trying to make a small batch file that automatically purge excess recordings when the HDD fills up.

It uses a purge.ini file to specify what should be deleted

Code:
close*.mpg    1
star*.mpg    0
crime*.mpg    2
*.mpg    20
The first item on each line specifies a dir mask used to define a group of recordings. The second item is the maximum number of recordings matching the file mask that should be kept.
The last line specifies that no more then 20 recordings should be kept in total

The purge.bat file reads the purge.ini file and processes each line
The oldest files matching the mask exceeding the count are deleted with a wildcard as extension mask.

Code:
@Echo off

for /F "usebackq tokens=1,2" %%i in ("purge.ini") do call :processline "%%i"  "%%j"
goto :eof

:processline
Echo .
Echo Rule : %1 %2
Echo -------------------------
dir/o:-d/b %1 >purge.lst
set/A counter=0
for /F "usebackq tokens=1,2" %%k in ("purge.lst") do call :processfile "%%k"  %%2 %%1
del/q purge.lst
goto :eof

:processfile
set/A level=%2
if  %counter% GEQ %level% call :purgefile %1
if  %counter% LSS %level% echo Keep:  "%~dpn1.*"
set/A counter=counter+1
goto :eof

:purgefile
echo Purge: "%~dpn1.*"
Del/q "%~dpn1.*"
goto :eof

:eof

purge.ini should be in the directory that should be purge.
purge.bat should be executed in the directory to be purged
A simple way to do this is to copy both files (of course you have to change purge.ini to your situation) into the directory that should be purged and to use a scheduled task to run purge.bat
For testing purposes it is recommended to manually execute purge and to put a 'rem' before the Del and to write the output to a log file as
purge >purge.log
I am still looking for an easy way to determine the amount of free space from a bat dos batch file so I can use that to delete old recorsdings i.s.o. using a maximum number of recordings.
Usual disclaimer: Use this at your own risk, this script can do terrible things

A zip file containing the two purge files can be downloaded from here
P4 3GHz 1GB, 250GB, nVidia dualTV, GBPVR 1.3.11, XP
Support Comskip, visit the forum and donate at http://www.comskip.org/
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,677
Threads: 767
Joined: Nov 2003
#2
2005-12-16, 03:53 PM
Do you do realize the users can already specify how many recordings to keep for each show when they schedule the recording?
erik
Offline

Posting Freak

Posts: 1,138
Threads: 123
Joined: Apr 2005
#3
2005-12-16, 04:57 PM
I do not use the scheduler from the guide menu because I have no monitor and keyboard connected to my PVR computer.
Is it possible through XScheduler (I manual edit and copy the xml file) or through webadmin?
P4 3GHz 1GB, 250GB, nVidia dualTV, GBPVR 1.3.11, XP
Support Comskip, visit the forum and donate at http://www.comskip.org/
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,677
Threads: 767
Joined: Nov 2003
#4
2005-12-16, 05:01 PM
Apparently its going to be added to the next version of web admin. They just waiting for my next release which adds this to the scheduler API. I dont know about XScheduler.
erik
Offline

Posting Freak

Posts: 1,138
Threads: 123
Joined: Apr 2005
#5
2005-12-16, 05:53 PM
Thanks, that's a very good reason to upgrade, I am still running 0.91.12, rock solid. Never had any problem. Good job!!!
P4 3GHz 1GB, 250GB, nVidia dualTV, GBPVR 1.3.11, XP
Support Comskip, visit the forum and donate at http://www.comskip.org/
KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#6
2005-12-16, 09:09 PM
Erik. Do a search on the forums for MaxRecordings. It'll do what you want, and it is simple to setup.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Import/export recordings via API? whurlston 4 3,785 2019-02-19, 11:48 AM
Last Post: Graham
  Conflict recordings scJohn 1 2,582 2018-03-23, 07:43 PM
Last Post: sub
  API / web call for setting recordings Pbathuk 2 3,290 2018-01-13, 05:17 AM
Last Post: Pbathuk
  API access to artwork and deleting recordings cncb 29 15,463 2016-11-06, 02:20 AM
Last Post: mvallevand
  How to move recordings without them getting deleted from db drmargarit 4 3,876 2015-09-27, 05:33 PM
Last Post: sub
  Best approach to creating recurring recordings from c# drmargarit 0 2,609 2015-09-27, 01:32 AM
Last Post: drmargarit
  Changing the recording priority on recurring recordings cbgifford 4 3,773 2014-08-17, 03:13 PM
Last Post: Kiwi
  How does NextPVR group recordings for XBMC? spinnaker 2 2,283 2013-11-21, 01:33 AM
Last Post: spinnaker
  Web API call for Ready recordings? bgowland 2 1,871 2013-11-03, 12:43 AM
Last Post: bgowland
  Delete recordings from database but not from disk? spinnaker 8 3,786 2013-10-26, 10:51 PM
Last Post: spinnaker

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode