<div dir="ltr"><div dir="ltr">On Thu, Jul 7, 2022 at 5:02 PM David Engel <<a href="mailto:david@istwok.net">david@istwok.net</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, Jul 07, 2022 at 01:33:49PM -0600, John P Poet wrote:<br>
> Hi David,<br>
> <br>
> After a call to<br>
> CardUtil::CreateCaptureCard()<br>
> and<br>
> CardUtil::CreateCardInput()<br>
> <br>
> The resulting capturecard and inputgroup tables look like:<br>
> <br>
> select * from capturecard;<br>
> +--------+----------+------------------------------------------------------------------------+-------------+-----------+----------+--------------+----------------+----------------+--------------+--------------+-----------------------+-------------+---------------+-----------------+----------------+----------------+---------------------+----------------+-----------------+------------------+----------+------------+--------+-----+----------+-------------+-----------+----------+-----------------+----------------+---------------+----------+-----------+-------------+-------------+-------------+-----------+------------+-------------+----------+------------+<br>
> | cardid | parentid | videodevice<br>
>                  | audiodevice | vbidevice | cardtype | defaultinput |<br>
> audioratelimit | hostname       | dvb_swfilter | dvb_sat_type |<br>
> dvb_wait_for_seqstart | skipbtaudio | dvb_on_demand | dvb_diseqc_type |<br>
> firewire_speed | firewire_model | firewire_connection | signal_timeout |<br>
> channel_timeout | dvb_tuning_delay | contrast | brightness | colour | hue |<br>
> diseqcid | dvb_eitscan | inputname | sourceid | externalcommand |<br>
> changer_device | changer_model | tunechan | startchan | displayname |<br>
> dishnet_eit | recpriority | quicktune | schedorder | livetvorder | reclimit<br>
> | schedgroup |<br>
> +--------+----------+------------------------------------------------------------------------+-------------+-----------+----------+--------------+----------------+----------------+--------------+--------------+-----------------------+-------------+---------------+-----------------+----------------+----------------+---------------------+----------------+-----------------+------------------+----------+------------+--------+-----+----------+-------------+-----------+----------+-----------------+----------------+---------------+----------+-----------+-------------+-------------+-------------+-----------+------------+-------------+----------+------------+<br>
> |      1 |        0 | /usr/local/bin/mythexternrecorder --conf<br>
> /home/mythtv/etc/mag-1-2.conf | NULL        | NULL      | EXTERNAL |<br>
> Television   |           NULL | <a href="http://cubic.sobie.us" rel="noreferrer" target="_blank">cubic.sobie.us</a> |            0 |<br>
>  0 |                     1 |           0 |             1 |               0<br>
> |              0 | NULL           |                   0 |              0 |<br>
>            4000 |                0 |        0 |          0 |      0 |   0 |<br>
>     NULL |           0 | MPEG2TS   |        2 |                 |<br>
>      |               |          |           | mag/1-2     |           0 |<br>
>         1 |         0 |          1 |           0 |        1 |          1 |<br>
> +--------+----------+------------------------------------------------------------------------+-------------+-----------+----------+--------------+----------------+----------------+--------------+--------------+-----------------------+-------------+---------------+-----------------+----------------+----------------+---------------------+----------------+-----------------+------------------+----------+------------+--------+-----+----------+-------------+-----------+----------+-----------------+----------------+---------------+----------+-----------+-------------+-------------+-------------+-----------+------------+-------------+----------+------------+<br>
> 1 row in set (0.001 sec)<br>
> <br>
> select * from inputgroup;<br>
> +-------------+--------------+-----------------------------------------------------------------------------------------+<br>
> | cardinputid | inputgroupid | inputgroupname<br>
>                                            |<br>
> +-------------+--------------+-----------------------------------------------------------------------------------------+<br>
> |           0 |            1 | <a href="http://cubic.sobie.us" rel="noreferrer" target="_blank">cubic.sobie.us</a>|/usr/local/bin/mythexternrecorder<br>
> --conf /home/mythtv/etc/mag-1-2.conf|1 |<br>
> |           1 |            1 | <a href="http://cubic.sobie.us" rel="noreferrer" target="_blank">cubic.sobie.us</a>|/usr/local/bin/mythexternrecorder<br>
> --conf /home/mythtv/etc/mag-1-2.conf|1 |<br>
> +-------------+--------------+-----------------------------------------------------------------------------------------+<br>
> 2 rows in set (0.001 sec)<br>
> <br>
> I am curious about the entry in inputgroup with a cardinputid of zero (0).<br>
> Is that what you would expect to see or is something amiss?<br>
> <br>
> I know you did some magic to make "multirec" work without having to create<br>
> a bunch of inputs. Does this happen automatically with a call<br>
> CardUtil::CreateCaptureCard() and/or CardUtil::CreateCardInput(), or are<br>
> extra steps necessary? I see that the default "reclimit" is 1, but did not<br>
> dig enough to see if that is still relevant. Does the multirec magic happen<br>
> when schedgroup is 1?<br>
> <br>
> To be clear, I am making these calls via the ServicesAPI and want to make<br>
> sure I am not missing any steps. I do want multirec to work.<br>
<br>
Okay.  I've refreshed my memory and remember what a mess is still left<br>
over.<br>
<br>
The inputgroup entry with cardinputid = 0 is a hold over from Daniel<br>
K's bad design of that table.  Basically, that entry is a placeholder<br>
for the mythtv-setup GUI to see the group name.  It's eventually<br>
cleaned up when CardUtil::UnlinkInputGroup(0, 0) is called.  The<br>
services API or whatever it ultimately calls also needs to make sure<br>
that cleanup occurs.  It's harmless as there can never be an inputid =<br>
0 but still should be cleaned up.<br>
<br>
The separate CardUtil::CreateCaptureCard() and<br>
CardUtil::CreateCardInput() methods are a holdover from the very, old<br>
days when they were truly separate.  The intent that was never<br>
finished was to combine the mythtv-setup screens for capture cards and<br>
inputs together.  The new services API should not perpetuate that<br>
split card/input interface.  IOW, the new API should have a single<br>
CreateInput() method exposed to API users. (*) (**).  As I've stated<br>
before the old, services API for cards and inputs was so bad, it<br>
should simple be deleted and never spoken of again.<br>
<br>
David<br>
<br>
(*)At the time card/input was refactored, "input" was chosen as the<br>
perferred name for tuner thingies.  I think all user-facing code<br>
except mythtv-setup tries to follow that naming.<br>
<br>
(**)Unless you are feeling really enegetic and want to rewrite much of<br>
CardUtil and it's callers to fully eradicate the remaining vestiges of<br>
separete cards and inputs, the API will need to call the separate,<br>
lower, level methods in the right way.  See CaptureCard::Save() and<br>
CardInput::Save() in videosource.cpp for examples.<br>
<br>
-- <br>
David Engel</blockquote><div><br></div><div>My first thought was that  CardUtil::UnlinkInputGroup(0, 0) should be added to the bottom of CardUtil::CreateCardInput, but that would be <i>slightly</i> inefficient. <br></div><div><br></div><div>Apparently there is an issue with the ServicesAPI and a limit to the maximum number of arguments. With V2, long argument lists are being passed as JSON to get around that issue. I will take a look at merging the capturecard and cardinput API calls for V2.</div><div><br></div><div>John</div><div><br></div></div></div>