[mythtv-users] find_orphans.py not working as expected
Gary Raposo
gary at raposo.ca
Fri May 15 20:58:25 UTC 2020
On 2020-05-13 2:30 p.m., Bill Meek wrote:
>> On 5/13/20 12:58 PM, Gary Raposo wrote:
>>> Hello all,
>>>
>>> During this extended period of physical distancing, I decided to
>>> rebuild my MythTV system. Overall it was a fairly smooth process and
>>> I'm now running MythTV 31 (installed from the RPM Fusion repo) on
>>> Fedora 31. Everything seems to be working as expected except for
>>> find_orphans.py. On my previous system I was using the old
>>> myth.find_orphans.pl so this is my first experience with
>>> find_orphans.py. My ultimate goal is to schedule find_orphans.py to
>>> run on a regular basis so that it will send an email if it
>>> encounters any issues.
>>>
>>> I've copied the code from
>>> https://www.mythtv.org/wiki/Find_orphans.py (find_orphans.py (for
>>> v31+)) and it runs but the results are a little confusing. Basically
>>> find_orphans.py returns every single recording as "Recordings with
>>> missing files".
>>>
>>> $ ./find_orphans.py
>>> Recordings with missing files
>>> ...
>>> odysseus: Saturday Night Live - SNL At
>>> Home 10201_20200510032700.ts
>>> ...
>>> Count: 127
>>> Please select from the following
>>> 1. Delete orphaned recording entries
>>> 2. Refresh list
>>> >
>>>
>>> I can confirm that the relevant files are in the recordings
>>> directory (e.g., 10201_20200510032700.ts). I can see and play the
>>> recording via mythfrontend as well as mythweb. Everything seems to
>>> be in order except for the find_orphans.py output.
>>>
>>> Is anyone else having issues with find_orphans.py? I'm not
>>> proficient with Python so looking for any tips, tricks, or guidance
>>> on how to get find_orphans.py working.
>>
>> "Works for me". Begin guess mode.
>>
>> New host (and/or new hostname)? What do these return:
>>
>> curl --header 'Accept:application/json'
>> localhost:6544/Myth/GetHostName
>> hostname
>>
>> As to scheduling, the program is interactive (so you must say yes to
>> things to be deleted.)
>>
Bill, just wanted to revisit the interactive nature of find_orphans.py.
I've been looking at Python long enough to be dangerous now. I copied
find_orphans.py to find_orphans_cron.py and changed the main function to:
def main(host=None):
recs, zerorecs, orphvids, orphimgs, dbbackup, unfiltered =
populate(host)
if len(recs):
printrecs("Recordings with missing files", recs)
if len(zerorecs):
printrecs("Zero byte recordings", zerorecs)
if len(orphvids):
printfiles("Orphaned video files", orphvids)
if len(orphimgs):
printfiles("Orphaned snapshots", orphimgs)
if len(unfiltered):
printfiles("Other files", unfiltered)
I stripped everything else out so that it just runs through with no
input expected/required. I then dropped find_orphans_cron.py into cron
so that it runs on a regular basis. I can review the report and launch
the interactive find_orphans.py if needed to clean up.
Not exactly elegant but it gets the job done :)
Gary
More information about the mythtv-users
mailing list