[mythtv] Automatic deletion
Chris Pinkham
cpinkham at bc2va.org
Fri Jul 4 00:51:07 EDT 2003
> > I have working code right now which implements AutoExpiration of old
> > files based upon record date. The code is designed to allow easy plugin
> If you have a moment and could send a quick diff my way I'd be very
> interested. I was having trouble devising one that didn't essentially
> duplicate what HandleQueryFreeSpace and HandleDeleteRecording did. However
> those routines annoyingly were very much tied to the idea of there being a
> PlaybackSock.
I'll email you a diff of my cvs tree. My code runs as a thread in mythbackend
so it runs on every backend. It wakes up every so often and checks the
amount of free space using 5 lines of code copied from HandleQueryFreeSpace
but modified a little. If the free space is below the threshold then it
gets an ordered list of which shows can be expired. It then proceeds to
delete the shows one by one until enough free space is available.
I split up HandleDeleteRecording into two functions. The original
function name still exists and takes the same parameters. It only has 3
lines of code now though to get a ProgramInfo object from the stringlist
passed in and then call the real DoHandleDeleteRecording with the ProgramInfo
object.
The delete is handled by sending an AUTO_EXPIRE message/event with the chanid
and starttime. The mainserver object receives this message and then calls
DoHandleDeleteRecording to do the actual delete.
> I don't know if you've implemented it this way but that path I was taking
> was going to add a new field to the record and recorded tables (and
> eventually recording profiles). I was going to make it an int, default to 0
I did pretty much exactly what you're describing. I added a 'autoexpire'
column to recorded and am going to add it to the record table when I setup
the gui stuff. It defaults to 1 now which means it can be auto-expired if
the auto-expire code is turned on (which is OFF by default). So, my code
to get the list of programs to expire just does
WHERE recorded.hostname = '%1'
AND autoexpire > 0
ORDER BY autoexpire ASC, starttime DESC
I get the list in reverse order because of the way I populate and expire
the list.
Chris
More information about the mythtv-dev
mailing list