[mythtv-users] How to check if a tuner is in use

Bill Meek keemllib at gmail.com
Wed Oct 15 20:53:13 UTC 2014


On 10/15/2014 03:10 PM, Hika van den Hoven wrote:
>> ...
>>> parser.add_argument('--host', type=str, required=False, metavar='<hostname>',
>>>       help='backend hostname,  default <local hostname>')
>
>> You could just add: default='localhost' to the above. Or,
>> leave required=True and on the command line type --host=localhost
>> or whatever you choose.
>
> Ah, but I need the 'local hostname' not 'localhost'! That's what
> Mythtv uses. Unless you only have one combined machine.

We must be talking about different things. The --host argument
is used to form the URL and should be the name of the host, as
in, the name in /etc/hosts. Which *may* be the same as the MythTV
hostname in its DB (used as a profile name.)

>>> URL='http://{}:6544/Dvr/GetEncoderList'.format(host)
>
>> Try the URL developed above (e.g. with your hostname
>> where {} is), from a browser to see everything that's
>> returned. And there's a lot. E.g. <DisplayName>ATSC-0</DisplayName>
>> could be used assuming your cards have unique names.
>
...
> I'm running 0.27.3 from gentoo, but all I get per encoder on that page
> is:
>      <Id>1</Id>
>      <HostName>GentooServer</HostName>
>      <Local>true</Local>
>      <Connected>true</Connected>
>      <State>7</State>
>      <SleepStatus>8</SleepStatus>
>      <LowOnFreeSpace>false</LowOnFreeSpace>
> and then a lot of info about the recording but no 'Inputs/Input'? So I
> see no other way to retrieve it.

Could be that it changed in 0.28-pre then. Note that the key is not
Inputs/Input, rather Input is contained in Inputs. pastebin your
entire output if you like. I'll be a single line when you paste it
but don't worry.
...
>> Added the break above because once you've found the
>> card if interest, there's no reason to keep looking.
>
> Thanks, what I would do in bash or VB.

You asked, I was hoping you'd know ;). But $? is the
return code from the last command executed. Perhaps:


yourScriptName ...............

RC=$?

if [ $RC -eq 0 ]; then
     echo "Tuner is idle....."
     ...
else
     ...
> Can I return the state? Like:
>      state = element.findtext('State')
>      sys.exit(state)
> or even:
>      sys.exit(element.findtext('State'))

I never tried returning a string. I thought it was always a
number 0-255.  Where 0 = true and non 0 = false.

As to you other question, more *endpoints* are documented here,
although a bit out of data: http://www.mythtv.org/wiki/Services_API

-- 
Bill


More information about the mythtv-users mailing list