Sure there is more than one way to delete all episodes of a recorded program with mythv - they are just not very obvious. So I decided that my first learning task with python will be to write a script that does just that. In order to do so, you need to learn how to connect to a database - that was real easy - the API is very similar to JDBC which is well, old hat. Finding ‘unlink’ though took a bit more time.
here is the full code.
#!/usr/bin/python
# import MySQL module
import MySQLdb
import os
# connect
db = MySQLdb.connect(host="radmedia", user="root", db="mythconverg")
# create a cursor
cursor = db.cursor()
# execute SQL statement
cursor.execute("SELECT basename FROM recorded WHERE title='sIRASAsirasa cartoon (Manual Record)'")
numrows = int(cursor.rowcount)
for x in range(0,numrows):
row = cursor.fetchone()
if os.path.exists("/store/" + row[0]):
os.unlink("/store/" + row[0])
if os.path.exists("/store/" + row[0] + ".png"):
os.unlink("/store/" + row[0] + ".png")
cursor.execute("DELETE FROM recorded WHERE title='sIRASAsirasa cartoon (Manual Record)'")
cursor.close()
The filesystem functions in Python are similar to what you find in PHP or even in C but the trouble is that they are hidden away either inside the os package or the os.path package. At first I thought os was all there was to it, and was scratching my head trying to figure out how to test for file existence. It was after a bit of diggint that I found os.path.exists()

With technology constantly advancing, there is no good reason to spend half a million dollars on recording a record. Php Program.
Who spent anything? We use all open source tools