[mythtv-users] Remove damaged recordings
Bill Meek
keemllib at gmail.com
Tue Aug 29 16:59:08 UTC 2017
On 08/29/2017 09:52 AM, Brent Bolin wrote:
> Hello All,
>
> Recently had an issue with damaged recordings. Thought it was just bad atmosphere transmissions (All OTA recordings). Turned out to be a bad
> amplified distribution box. Reset the power and things are good now.
>
> Is there a way to find and delete them? They show up in Mythweb and think there is a database entry indicating this. I've seen some scripts
> dealing with this, but it's not clear if they work or if it's safe to run.
This is the Python program I use to PRINT damaged
recordings.
The last 5 lines are additions. It will
remove *one* title/subtitle of your choice. If it works
as expected, then remove the 'if ...' and adjust the
indents on the remaining lines.
But like Mike just said, be careful.
$ cat damaged.py
#!/usr/bin/env python
"""
Print info for recordings marked as damaged.
"""
import sys
from MythTV import MythBE, MythDB
try:
DB = MythDB()
BE = MythBE()
except IndexError:
sys.exit('Unable to connect to the backend, aborting.')
HEADING_PRINTED = False
for recording in DB.searchRecorded():
# pylint: disable=maybe-no-member
pgm = recording.getRecordedProgram()
# pylint: enable=maybe-no-member
if not 'DAMAGED' in pgm.videoprop:
continue
if not HEADING_PRINTED:
HEADING_PRINTED = True
print '\n {:30.30} {:15.15} {:17} {}'.format(
'Title', 'Sub Title', 'Starttime', 'Video Properties')
print ' {:30.30} {:15.15} {} {}'.format(
pgm.title,
pgm.subtitle,
pgm.starttime.strftime("%b %d %Y %H:%M"),
pgm.videoprop)
if pgm.title == 'Some Program Title' and \
pgm.subtitle == 'That You Want To Test With':
rec = BE.getRecording(pgm.chanid, pgm.starttime)
print 'Deleting: {} ({})'.format(pgm.title, rec.filename)
BE.deleteRecording(rec)
Recordings won't vanish immediately, just like find_orphans, so
don't worry if they still appear to be there.
Or, you could use the Services API:
curl yourbackend:6544/Dvr/DeleteRecording?RecordedId=xxx\&AllowRerecord=True
RecordedId can be replaced by ChanId and StartTime
--
Bill
More information about the mythtv-users
mailing list