[mythtv-users] find_orphans.py not working; fixed?

D. Hugh Redelmeier hugh at mimosa.com
Mon Jul 2 00:37:38 UTC 2012


| From: D. Hugh Redelmeier <hugh at mimosa.com>
| Subject: [mythtv-users] mythwikiscripts broken? [was: Re: find_orphans.py]
| 
| A few months ago, there were a couple of reports of problems with 
| mythwikiscripts.  They were buried in a discussion of find_orphans.py.

| I'm running MythTV 0.24 + fixes as produced by MythBuntu.  The distro is 
| Ubuntu 10.04 LTS.

What I was trying to do was download the find_orphans.py script:
<http://www.mythtv.org/wiki/Find_orphans.py>

I gave up on mythwikiscripts (it's broken in a way that I described in
my previous message; a few minutes of debugging didn't lead to a
solution).

I directly downloaded the script from the web page (copy from firefox
screen, paste into an editor window).

The script almost worked.  The failure mode was that, when given
permission to "Delete orphaned recording entries", it tried and
thought it failed.  In fact, it succeeded in on some but gave up at
the first failure.

I changed the Python code to handle the "failure" of a delete on a per
recording basis.  The code would no longer stop deleting but would
continue with subsequent recordings on the list.

Not only did the deletion then work, but I didn't even get the
expected diagnostics.  So the change is a success, but I don't know
why.  Most surprising: that the new diagnostic code I put in never
actually fired.

So: I don't know why this worked for me, but it did.

The new code is a copy of code a few lines on, but the new code is
inside a loop that the old code is outside of.

================
hugh at redblack:~$ diff -u bin/find_orphans.py bin/find_orphans.fudged.py
--- bin/find_orphans.py	2012-07-01 17:37:34.000000000 -0400
+++ bin/find_orphans.fudged.py	2012-07-01 19:52:42.000000000 -0400
@@ -126,7 +126,13 @@
         while True:
             if res == 'yes':
                 for rec in recs:
-                    rec.delete(True, True)
+                    try:
+                        rec.delete(True, True)
+                    except MythError:
+                        name = u'{0.hostname}: {0.title}'.format(rec)
+                        if rec.subtitle:
+                            name += ' - '+rec.subtitle
+                        print "Ignoring: Failed to delete '" + name + "'"
                 break
             elif res == 'no':
                 break
================


More information about the mythtv-users mailing list