[mythtv-users] find_orphans.py not working as expected

Gary Raposo gary at raposo.ca
Fri May 15 18:59:05 UTC 2020


On 2020-05-15 1:34 p.m., Dan Wilga wrote:
> On 5/15/20 9:41 AM, Gary Raposo wrote:
>> On 2020-05-14 5:09 p.m., Bill Meek wrote:
>>> On 5/14/20 3:19 PM, Gary Raposo wrote:
>>> ...
>>>
>>> If I have a host value that doesn't match my recordings, then I get all
>>> recordings showing up as missing.
>>>
>>> Try printing the hosts value like this:
>>>
>>>     else:
>>>         with DB as c:
>>>             c.execute("""SELECT hostname FROM settings
>>>                          WHERE value='BackendServerIP'""")
>>>             hosts = [r[0] for r in c.fetchall()]
>>>             print('hosts=',hosts) # <---------------------------
>>>
>>> Look at some recordings. Press 'i' twice and see what the value of
>>> Recording Host: is set to.
>>>
>>
>> Thanks for the suggestions, Bill. Still no luck.
>>
>> I checked the settings table and I do not have an entry for 
>> BackendServerIP. I do have a valid/correct entry for MasterServerIP 
>> so changed the code to reference MasterServerIP. No change.
>>
>> If I add the print statement you suggested, it's still showing None:
>> hosts= [None]
>>
>> Checking my recordings (pressing "i" twice) I can see that they are 
>> all correctly tagged with odysseus as the hostname. MasterServerIP 
>> references the correct IP address for odysseus and /etc/hosts matches.
>>
>> Looking at the query, it looks like they are pulling hostname from 
>> the settings table for the entry associated with the 
>> BackendServerIP/MasterServerIP. I hadn't really looked at it that 
>> closely before and assumed they were pulling the hostname based on 
>> the data field. Wouldn't you know it, hostname is set to NULL for 
>> that entry.
>>
>> I updated the settings table and set hostname = odysseus for 
>> MasterServerIP + added an entry for BackendServerIP (just in case) 
>> and now I've moved on to a whole different set of problems!
>>
>> Before, I was able to see all my recordings but they were listed as 
>> "Recordings with missing files". Now I get no output and the 
>> following errors:
>>
>> $ ./find_orphans.py
>> Traceback (most recent call last):
>>   File "./find_orphans.py", line 222, in <module>
>>     BE = MythBE(db=DB)
>>   File "/usr/lib/python3.7/site-packages/MythTV/mythproto.py", line 
>> 80, in __init__
>>     self.hostname = self.db._gethostfromaddr(self.host)
>>   File "/usr/lib/python3.7/site-packages/MythTV/database.py", line 
>> 1348, in _gethostfromaddr
>>     'BackendServerAddr', addr)
>> MythTV.exceptions.MythDBError: Could not find setting 
>> 'BackendServerAddr' on host 'None'
>>
>> Not too sure what's going on. Looking at the settings table, I have 
>> three entries: BackendServerIP, MasterServerIP, and 
>> BackendServerAddr. All have data set to 10.10.10.20 and hostname = 
>> odysseus.
>>
>> I'm poking around now in mythproto.py and database.py but (again) my 
>> lack of Python experience is making this a slow process.
>>
>> As always, any suggestions are welcome. 
>
> Forgive me if I missed it, but did you try simply:
>
>   ./find_orphans.py odysseus
>
> The script takes one parameter, the host name, as defined in the 
> settings. To get a list of all the hostnames in use, you can also do:
>
>   echo 'select distinct hostname from mythconverg.settings;' | mysql 
> -u mythtv -p
>
> This will include frontends.
>

Hi Dan,

In one of the previous updates I mentioned that command line arguments 
don't seem to work either. Same error message:

$ ./find_orphans.py odysseus
Traceback (most recent call last):
   File "./find_orphans.py", line 222, in <module>
     BE = MythBE(db=DB)
   File "/usr/lib/python3.7/site-packages/MythTV/mythproto.py", line 80, 
in __init__
     self.hostname = self.db._gethostfromaddr(self.host)
   File "/usr/lib/python3.7/site-packages/MythTV/database.py", line 
1348, in _gethostfromaddr
     'BackendServerAddr', addr)
MythTV.exceptions.MythDBError: Could not find setting 
'BackendServerAddr' on host 'None'

Hostnames in use makes sense as this is a combined FE/BE.

$ echo 'select distinct hostname from mythconverg.settings;' | mysql -u 
mythtv -p
Enter password:
hostname
odysseus
NULL

Gary



More information about the mythtv-users mailing list