find_orphans.py Fails

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

find_orphans.py Fails

Postby jamoody » Tue Jul 26, 2016 2:43 am

Power failure caused database corruption so I restored from a backup 2 days old. The restored database works fine but is of course out of sync with recording files. Ran find_orphans (dated Nov 2011) which correctly identified the orphaned recording entries for recordings deleted since the backup was created. When I tried to tell find_orphans to delete these orphaned recording entries the script fails with the following traceback:

Are you sure you want to continue?
> yes
Traceback (most recent call last):
File "./find_orphans.py", line 230, in <module>
main()
File "./find_orphans.py", line 214, in main
opt[1](opt[2])
File "./find_orphans.py", line 129, in delete_recs
rec.delete(True, True)
File "/usr/lib/python2.7/dist-packages/MythTV/dataheap.py", line 365, in delete
return self.getProgram().delete(force, rerecord)
File "/usr/lib/python2.7/dist-packages/MythTV/dataheap.py", line 377, in getProgram
return Program.fromRecorded(self)
File "/usr/lib/python2.7/dist-packages/MythTV/mythproto.py", line 943, in fromRecorded
return be.getRecording(rec.chanid, rec.starttime)
File "/usr/lib/python2.7/dist-packages/MythTV/mythproto.py", line 644, in getRecording
return Program(res[1:], db=self.db)
File "/usr/lib/python2.7/dist-packages/MythTV/mythproto.py", line 872, in __init__
DictData.__init__(self, raw)
File "/usr/lib/python2.7/dist-packages/MythTV/altdict.py", line 147, in __init__
data = self._process(data)
File "/usr/lib/python2.7/dist-packages/MythTV/altdict.py", line 163, in _process
data[i] = self._trans[self._field_type[i]](v)
File "/usr/lib/python2.7/dist-packages/MythTV/altdict.py", line 103, in <lambda>
lambda x: datetime.fromtimestamp(x, datetime.UTCTZ())\
File "/usr/lib/python2.7/dist-packages/MythTV/utility/dt.py", line 304, in fromtimestamp
obj = super(datetime, cls).fromtimestamp(float(timestamp), tz)
ValueError: timestamp out of range for platform time_t

I recently moved to MythTV 028.-45. Any ideas on how to delete the bad entries from the database?
United States of Americajamoody
Junior
 
Posts: 70
Joined: Mon Aug 18, 2014 4:19 pm

Re: find_orphans.py Fails

Postby jamoody » Tue Jul 26, 2016 2:56 am

I updated my copy of find_orphans.py from https://www.mythtv.org/wiki/Find_orphans.py which was slightly different than the version I was using, but no change:

Traceback (most recent call last):
File "./find_orphans2.py", line 230, in <module>
main()
File "./find_orphans2.py", line 214, in main
opt[1](opt[2])
File "./find_orphans2.py", line 129, in delete_recs
rec.delete(True, True)
File "/usr/lib/python2.7/dist-packages/MythTV/dataheap.py", line 365, in delete
return self.getProgram().delete(force, rerecord)
File "/usr/lib/python2.7/dist-packages/MythTV/dataheap.py", line 377, in getProgram
return Program.fromRecorded(self)
File "/usr/lib/python2.7/dist-packages/MythTV/mythproto.py", line 943, in fromRecorded
return be.getRecording(rec.chanid, rec.starttime)
File "/usr/lib/python2.7/dist-packages/MythTV/mythproto.py", line 644, in getRecording
return Program(res[1:], db=self.db)
File "/usr/lib/python2.7/dist-packages/MythTV/mythproto.py", line 872, in __init__
DictData.__init__(self, raw)
File "/usr/lib/python2.7/dist-packages/MythTV/altdict.py", line 147, in __init__
data = self._process(data)
File "/usr/lib/python2.7/dist-packages/MythTV/altdict.py", line 163, in _process
data[i] = self._trans[self._field_type[i]](v)
File "/usr/lib/python2.7/dist-packages/MythTV/altdict.py", line 103, in <lambda>
lambda x: datetime.fromtimestamp(x, datetime.UTCTZ())\
File "/usr/lib/python2.7/dist-packages/MythTV/utility/dt.py", line 304, in fromtimestamp
obj = super(datetime, cls).fromtimestamp(float(timestamp), tz)
ValueError: timestamp out of range for platform time_t
United States of Americajamoody
Junior
 
Posts: 70
Joined: Mon Aug 18, 2014 4:19 pm

Re: find_orphans.py Fails

Postby jamoody » Wed Jul 27, 2016 12:07 pm

Worked around the problem with find_orphans failing by manually creating the missing files (copied another recording to the missing file name) and then deleted the recording per usual in MythTV. Time consuming, but it worked. Hopefully someone will identify the problem with find_orphans and fix it eventually.
United States of Americajamoody
Junior
 
Posts: 70
Joined: Mon Aug 18, 2014 4:19 pm

Re: find_orphans.py Fails

Postby pgbennett » Wed Jul 27, 2016 2:35 pm

If you have a recording in your database but the file is missing you should be able to find it in "watch recordings" on the frontend. It will not play and will show with a red border or something to indicate the file is missing, but you should be able to select "menu" and then delete it. After that you should check group "deleted" and delete again if it is there.
User avatar
United States of Americapgbennett
Developer
 
Posts: 117
Joined: Mon Apr 27, 2015 5:41 pm

Re: find_orphans.py Fails

Postby jamoody » Thu Jul 28, 2016 4:26 pm

These orphaned entries were already in the deleted list at the time of the database backup with the files actually removed between the backup and restore. Automatic and manual removal of the orphaned entries from the System Status -> Auto Expire list failed and the entries remained in the Auto Expire list forever. Perhaps that is where an improvement can be made. Deleting orphaned entries for the Watch Recordings list works fine, but not from the Auto Expire list.
United States of Americajamoody
Junior
 
Posts: 70
Joined: Mon Aug 18, 2014 4:19 pm

Re: find_orphans.py Fails

Postby kb8qew » Mon Jun 19, 2017 11:14 am

If this helps,

find_orphans.py did not work for me. Then I looked at the permissions of the files it was trying to delete. It seems my backend was recording files as root. I did a chmod mythtv:mythtv and ran find_orphans.py again and it was successful in deleting the files.
United States of Americakb8qew
Newcomer
 
Posts: 2
Joined: Wed Jul 13, 2016 11:18 am

Re: find_orphans.py Fails

Postby pgbennett » Mon Jun 19, 2017 2:00 pm

jamoody wrote:These orphaned entries were already in the deleted list at the time of the database backup with the files actually removed between the backup and restore. Automatic and manual removal of the orphaned entries from the System Status -> Auto Expire list failed and the entries remained in the Auto Expire list forever. Perhaps that is where an improvement can be made. Deleting orphaned entries for the Watch Recordings list works fine, but not from the Auto Expire list.


I did not see this response when you made it. You can select the "deleted" recording group in the Watch recordings screen and apply the process there.
User avatar
United States of Americapgbennett
Developer
 
Posts: 117
Joined: Mon Apr 27, 2015 5:41 pm


Return to Troubleshooting



Who is online

Users browsing this forum: No registered users and 2 guests