[mythtv-users] Fully delete rec from cli

Chris Pinkham cpinkham at bc2va.org
Mon Aug 28 04:04:55 UTC 2006

* On Sun Aug 27, 2006 at 07:39:35AM -0400, Andrew Guenther wrote:
> Quick request. I did about 30 mins of googling and was surprised I
> could not find this anywhere.
> What I would like to do is properly and completely delete a recording
> from command line/cron.

Might not have to do that if you take advantage of other builtin

> EX: I set my box to record the evening news and record all simpsons
> episodes. If any news broadcast is 48 hours old, I want it to expire
> and go away. I don't want to loose old simpsons episodes if I don't
> have to, BUT I do want everything to autoexpire at some point.

If you only want 2 days worth of the evening news then set maxepisodes
to be 2 and then turn on setting that says "Delete oldest if this would
exceed the max episodes."  That will keep the 2 newest episodes around
and delete anything over 2.  So if you don't watch any episodes, Myth
will record the new one each day and delete the oldest one so there are
only 2 left.

AutoExpire works by ordering recordings by their 'autoexpire' field.
If you want The Simpsons to expire after Futurama, then you can manually
update the autoexpire field for Futurama to 2 and leave the Simpsons
at the default of 1.  This is an integer field in the database but
the scheduled recording editor only allows you to set it to 0 (Don't
allow auto expire) or 1 (Allow auto expire).  If you set Futurama to
2 in the record and recorded tables in the database then episodes of
Futurama will expire before the Simpsons.

If you want everything to expire before the Simpsons then you'd need to
set everything to 2 and leave the Simpsons at 1.  Something like the
following SQL:

update record set autoexpire = 2;
update record set autoexpire = 1 where title = "The Simpsons";
update recorded set autoexpire = 2;
update recorded set autoexpire = 1 where title = "The Simpsons";

To see the order different shows will expire in do this:

select title, autoexpire from recorded order by autoexpire, title;

All recordings with an equal autoexpire value will be expired in the
order you specified in the setup screen (I use 'oldest first').

Keep in mind that if you do this, the numbers higher than 1 will
probably get reset to 1 if you go into the scheduled recording editor
for the recording since Myth only supports 0 and 1 right now for that
field in the editor.

This is also how MythTV knows to expire LiveTV recordings first.  LiveTV
recordings have their autoexpire field in the DB set to 10000 so that
they get expired first before any normal recordings.

> Anyone know what setting 'deletepending'=1 in the recorded table does,
> just by itself? Found this off in googleland:
> UPDATE recorded SET deletepending = 1 WHERE chanid = '1027' AND
> starttime = '2006-07-06T00:13:28' ;

deletepending is a flag that is set to tell the backend that a recording
is currently being deleted so that when the frontend requests a list
of recordings the ones being deleted are hidden from the user's view.
This flag should only be set by the backend, setting it yourself will
have no effect other than to make the recording disappear from your
Watch Recordings screen for a few minutes.


More information about the mythtv-users mailing list