Forums » Tutorial and setups »
Any way to delete recorded program from a script ??
Added by Mark Kirkpatrick over 11 years ago
I've gotten it pretty clean, I record MPG2 files ( from HDHomerun ) so I can keep the Closed Caption and run comskip. I have a script that takes the HUGE 5-8 GB files and re-encodes them down to 200-200 MB per TV show.
1) Run linux native comskip against the big MPG2 to produce an edit cut list for XBMC.
2) re-encode with handbrake and keep CC and shrink files to 250MB.
3) compare Video times with ffmpeg in old and new and if within xx seconds of each other delete the original PIG.
I have a separate EPG feed script that gets the listings for free and feeds tvheadend the XML file via netcat and a domain socket.
So now it's hands off ! I can hold a few years of TV without having to clean up and I go to XBMC and call up the latest TV shows all compressed and commercial edited in a pretty view ready to watch. Only hassle is TVHeadend is upset when I delete the original HUGH MPG2 file from the script and marks the recording as failed. So every recording is failed. Any way to delete them out programatically ? Or maybe clean-up the file system behind the scenes would work ?
Replies (4)
RE: Any way to delete recorded program from a script ?? - Added by Anonymous over 11 years ago
did you ever figure something out around this? is there any way to send a command to the web interface with curl? what about using the method with HTSP that XBMC supposedly uses?
RE: Any way to delete recorded program from a script ?? - Added by Adam Sutton over 11 years ago
Read HTSP
And there is a simple python library that I wrote for some testing, that will probably give a basis to interact with TVH via HTSP. See lib/py and support/htspmon in the source tree, that should give a reasonable starting point.
Adam
RE: Any way to delete recorded program from a script ?? - Added by Mark Kirkpatrick over 11 years ago
Thanks Much, I'll play with this
RE: Any way to delete recorded program from a script ?? - Added by Mark Kirkpatrick about 11 years ago
So I did get a chance to play with this and got something going with the HTSP python
added the deleteDvrEntry (Added in version 4)
Delete an existing DVR entry from the database.
Request message fields:
id u32 required DVR Entry ID
function to the library htsp.py under the source/lib tree ( clone the one above and change names )
I then cloned the support script for htspmon and added a command line option for id and replaced the async with the delete:
./htspmon_del --id 1
2013-10-17 14:21:46 INFO : connected to HTS Tvheadend [3.5.244~gf5c5ffd]
2013-10-17 14:21:46 INFO : using protocol v6
2013-10-17 14:21:46 INFO : capabilities [cwc,v4l,linuxdvb,timeshift,trace]
2013-10-17 14:21:46 INFO : Deleted hts dvr entry 1
2013-10-17 14:21:46 INFO : message:
2013-10-17 14:21:46 INFO : { 'success': 1}
The only cluge part is finding the id. I am using "grep -l <recordinfilename> /root/.hts/tvheadend/dvr/log/*" to pull it from the hts filesystem.
Code changed:
# Authenticate
if opts.user:
htsp.authenticate(opts.user, opts.passwd)
log.info('authenticated as %s' % opts.user)
- delete dvr entry
args = {}
if opts.id:
args['id'] = opts.id ;
htsp.deleteDvrEntry(args)
log.info('Deleted hts dvr entry %s' % opts.id)
- Process messages