Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Users

Fully delete rec from cli

 

 

MythTV users RSS feed   Index | Next | Previous | View Threaded


andguent at gmail

Aug 27, 2006, 4:39 AM

Post #1 of 6 (1986 views)
Permalink
Fully delete rec from cli

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.

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.

I'm already familiar with mythname.pl to pull out the program name &
subtitle, I just can't find any pre-built way to start deleting sql
entries. If I understood more php I would go find the function that
runs when you hit delete on mythweb/recorded_programs.php. I seem to
get lost in there, and I don't know enough sql/schema to properly roll
my own.

Does anyone have resources or links to someone who already has this?
Other ideas and hints greatly appreciated.

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' ;

Thanks.


Andrew
_______________________________________________
mythtv-users mailing list
mythtv-users[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


steve.p.daniels at googlemail

Aug 27, 2006, 7:41 AM

Post #2 of 6 (1850 views)
Permalink
Re: Fully delete rec from cli [In reply to]

> -----Original Message-----
> From: mythtv-users-bounces[at]mythtv.org [mailto:mythtv-users-
> bounces[at]mythtv.org] On Behalf Of Andrew Guenther
> Sent: 27 August 2006 12:40
> To: Discussion about mythtv
> Subject: [mythtv-users] Fully delete rec from cli
>
> 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.
>
> 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.
>
> I'm already familiar with mythname.pl to pull out the program name &
> subtitle, I just can't find any pre-built way to start deleting sql
> entries. If I understood more php I would go find the function that
> runs when you hit delete on mythweb/recorded_programs.php. I seem to
> get lost in there, and I don't know enough sql/schema to properly roll
> my own.
>
> Does anyone have resources or links to someone who already has this?
> Other ideas and hints greatly appreciated.
>
> 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' ;
>
> Thanks.
>
>
> Andrew

Hi Andrew,

I think that people haven't really needed something like this enough for it
to be made. (Have seen a request vaguely like this a while back IIRC) If you
could tell us why you want the system to do this, we might be able to tell
you how best to achieve your goals using the currently available
configuration options.

You might want to look into how the auto expirer can deal with priorities.
(mythfrontend - Utilities/Setup - Setup - TV Settings - General) Experiment
with that?

HTH

Steve Daniels


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/428 - Release Date: 25/08/2006


_______________________________________________
mythtv-users mailing list
mythtv-users[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


cpinkham at bc2va

Aug 27, 2006, 9:04 PM

Post #3 of 6 (1857 views)
Permalink
Re: Fully delete rec from cli [In reply to]

* 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
features.

> 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.

--
Chris
_______________________________________________
mythtv-users mailing list
mythtv-users[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


andguent at gmail

Aug 28, 2006, 5:26 PM

Post #4 of 6 (1847 views)
Permalink
Re: Fully delete rec from cli [In reply to]

On 8/28/06, Chris Pinkham <cpinkham[at]bc2va.org> wrote:
> * 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
> features.
>
> > 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.
>
> --
> Chris
> _______________________________________________
> mythtv-users mailing list
> mythtv-users[at]mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>

My example may have been over simplified. All this info is excellent,
but I'm still very interested in a way to cleanly remove a recording
and all associated sql data.

One reason to want this is that I came back to my myth box after a
week of being busy and found that my antenna cable fell out. The last
week worth of recordings was just snow. Plugging the cable back in
fixed that (serves me right for cleaning).

I already set all those nuv's to 0 bytes, but mythweb still shows me
my favorite png preview of a white rabbit in a blizzard, times 15+. I
would absolutley love to build a quickie for loop that if age is
greater than this and less than that, delete. It would be quicker then
using mythweb to delete one at a time.

The ideas for configuring via frontend are very informative. I very
much like the autoexpire=1000 if it really is as simple as setting
something that high to make a recording go away.

My complication with using the frontend to configure is that I run no
frontends at all. My backend is a 500mhz, 128ram, with a pvr350,
sitting in runlevel 3. The only way I watch my tv is via smb, nfs, or
rsync. Yes I could bump it to runlevel 5 and haul a monitor over, but
I'd rather write scripts. I'm lazy.

I have other reasons for wanting to cron it all as well. Something
along the lines of:
If recording is not myshows[] and age > 30 days then delete

I'd rather maintain a listing of shows I want to keep than track what
everyone else sets to record.

Thanks for the ideas. I'm up for more.


Andrew
_______________________________________________
mythtv-users mailing list
mythtv-users[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


f-myth-users at media

Aug 28, 2006, 5:49 PM

Post #5 of 6 (1833 views)
Permalink
Fully delete rec from cli [In reply to]

The easiest way I've found to do deletions is to pretend I'm a web
client. In other words, I went to the Recorded Programs page in a
browser and dumped the page source. You'll find that there are
non-Javascript links (for supporting browsers which have JS turned
off) on the page. In 0.18.1, they're of the form
http://host/mythweb/recorded_programs.php?delete=yes&file=filename
where "host" and "filename" should be substituted as appropriate.

I have automation that deletes programs, it just does something like
wget -O /dev/null -a logfile -q http://....

Yeah, yeah, it'd be cleaner to send a message using the Myth protocol
to the backend, or delete the file myself and then diddle with the
database -and still- send a message so any frontends get their state
updated, but the Mythweb approach was really, really straightforward,
and it insulates me from the underlying details of the implementation
---no matter -what- Myth does, I can be pretty confident that Mythweb
of the matching version will still be able to delete files. And if
the URL that Mythweb uses changes, that's a quick fix. (And there's
no standalone client to send arbitrary Myth-protocol messages, and I
didn't feel like writing one.)

Note: For the first couple of months, files vanished instantly (this
is on a JFS filesystem, and again remember that I'm using 0.18.1 so
there's none of this incremental-delete stuff going on). For some
reason I've never figured out, things suddenly changed such that it now
takes 5-6 seconds for the actual filename to vanish from the filesystem.
Yes, the database is optimized & the FS is healthy, yadda yadda. Since
my automation does error-checking by ensuring that the file really
-does- vanish before it moves onto the next (in part to guard against
errors, and in part not to totally pound mythweb & mysql into the
ground), I had to put a short loop in that checks once a second until
the file actually disappears. It typically takes 5-6s; the script
would alarm if it took more than 30, but it hasn't. (And I do mean
"suddenly"; what -was- sub-second jumped discontinuously to 5+ seconds.
It wasn't some gradual bit-rot sort of slowdown. The machine's
configuration hadn't been touched in weeks; in fact, it hadn't even
been -booted- for several days before that. Mythweb returns almost
immediately (e.g., the wget terminates fast); it then takes 5-6s after
-that- for the file to go away. Mythweb is running on the MBE, and
the files sit directly there; while there are NFS mounts on the
machine, the actual video directory is local and not NFS-mounted.)

P.S. The existence of these delete links is why it's so vitally
important to make sure that your Mythweb is protected from access
by any untrusted host or browser (including -yourself- running a
wget with the wrong URL and a recursive retrieval option). Otherwise,
even an innocent spider will delete all your recordings.
_______________________________________________
mythtv-users mailing list
mythtv-users[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


andguent at gmail

Aug 31, 2006, 7:53 PM

Post #6 of 6 (1810 views)
Permalink
Re: Fully delete rec from cli [In reply to]

On 8/28/06, f-myth-users[at]media.mit.edu <f-myth-users[at]media.mit.edu> wrote:
> The easiest way I've found to do deletions is to pretend I'm a web
> client. In other words, I went to the Recorded Programs page in a
> browser and dumped the page source. You'll find that there are
> non-Javascript links (for supporting browsers which have JS turned
> off) on the page. In 0.18.1, they're of the form
> http://host/mythweb/recorded_programs.php?delete=yes&file=filename
> where "host" and "filename" should be substituted as appropriate.
>
> I have automation that deletes programs, it just does something like
> wget -O /dev/null -a logfile -q http://....
>
> Yeah, yeah, it'd be cleaner to send a message using the Myth protocol
> to the backend, or delete the file myself and then diddle with the
> database -and still- send a message so any frontends get their state
> updated, but the Mythweb approach was really, really straightforward,
> and it insulates me from the underlying details of the implementation
> ---no matter -what- Myth does, I can be pretty confident that Mythweb
> of the matching version will still be able to delete files. And if
> the URL that Mythweb uses changes, that's a quick fix. (And there's
> no standalone client to send arbitrary Myth-protocol messages, and I
> didn't feel like writing one.)
>
> Note: For the first couple of months, files vanished instantly (this
> is on a JFS filesystem, and again remember that I'm using 0.18.1 so
> there's none of this incremental-delete stuff going on). For some
> reason I've never figured out, things suddenly changed such that it now
> takes 5-6 seconds for the actual filename to vanish from the filesystem.
> Yes, the database is optimized & the FS is healthy, yadda yadda. Since
> my automation does error-checking by ensuring that the file really
> -does- vanish before it moves onto the next (in part to guard against
> errors, and in part not to totally pound mythweb & mysql into the
> ground), I had to put a short loop in that checks once a second until
> the file actually disappears. It typically takes 5-6s; the script
> would alarm if it took more than 30, but it hasn't. (And I do mean
> "suddenly"; what -was- sub-second jumped discontinuously to 5+ seconds.
> It wasn't some gradual bit-rot sort of slowdown. The machine's
> configuration hadn't been touched in weeks; in fact, it hadn't even
> been -booted- for several days before that. Mythweb returns almost
> immediately (e.g., the wget terminates fast); it then takes 5-6s after
> -that- for the file to go away. Mythweb is running on the MBE, and
> the files sit directly there; while there are NFS mounts on the
> machine, the actual video directory is local and not NFS-mounted.)
>
> P.S. The existence of these delete links is why it's so vitally
> important to make sure that your Mythweb is protected from access
> by any untrusted host or browser (including -yourself- running a
> wget with the wrong URL and a recursive retrieval option). Otherwise,
> even an innocent spider will delete all your recordings.
> _______________________________________________
> mythtv-users mailing list
> mythtv-users[at]mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>


I love it. The full path I still had to go check through the source for:
wget -O /dev/null -a logfile -q \
http://192.168.1.3/mythweb/recorded_programs.php?delete=yes&file=%2Fmyth%2Ftv%2F1017_20060826070000_20060826073000.nuv

As of now, I can type the full http path into Firefox and have the
file delete. I'm trying the same patch both with wget and lynx -dump,
but no result. This is definitely a point in the direction I wanted.
Now I just have to figure out who is smarter, me or the box.

Thanks all for your time and knowledge.


Andrew
_______________________________________________
mythtv-users mailing list
mythtv-users[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

MythTV users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.