[mythtv-users] How do I remove all recordings from the database?

Ian Campbell ijc at hellion.org.uk
Thu Jul 27 07:48:48 UTC 2017


On Thu, 2017-07-27 at 08:35 +0100, Gadgetmind wrote:
> Is it as easy as "DELETE FROM recorded;" and then remove all the mpg and 
> png files from mythtv/recorded?
> 
> Any other data to tidy up?

In general it is best to use the API for interacting with MythTV rather
than hitting the database directly.

When I want to nuke a series or part of one I use the Python script
below, it should be pretty trivial to modify it to nuke everything and
to request no rerecord.

Ian.

#!/usr/bin/python

import sys
import os.path
sys.path.append('/home/ijc/development/pvr/mythtv/mythtv/mythtv/bindings/python/')
from MythTV import *

db = MythDB()

be = MythBE()

title=sys.argv[1]
episodes=sys.argv[2:]
print "ReRecording: \"%s\"" % (title)

for rec in db.searchRecorded(title=title):
    if rec.title != title:
        continue

    print "Episode: %s" % rec.subtitle

    if episodes == [] or rec.subtitle in episodes:
        prog = Program.fromRecorded(rec)
        prog.delete(rerecord=True)


More information about the mythtv-users mailing list