[mythtv-users] What API to change recording group?

Peter Bennett pb.mythtv at gmail.com
Sat Oct 30 21:18:37 UTC 2021


On 10/30/21 4:45 PM, Ken Bass wrote:
> On 10/30/2021 4:28 PM, Jim Abernathy wrote:
>>
>>
>> On 10/30/21 12:29 PM, Ken Bass wrote:
>>> I have what appears to be a very simple request. How do I 'move' an 
>>> existing recording from one recording group to another?
>>>
>>> The easiest would be if this could be accomplished via mythweb...a 
>>> simple dropdown for the Recording Group.
>>
>>
>> If I understand what you want to do it is an option in mythfrontend. 
>> right arrow on the recording you want to move and change the Storage 
>> Group -> Change Recording Group.
>>
>
> Correct, that is in the mythfrontend, however I use a Kodi frontend 
> and even with mythfrontend it is really time consuming (especially if 
> you try to perform mass changes using playlist option). That is why I 
> am looking for an API method to do this.
>
>
I have been pondering whether to add an API to change the recording 
group. I need to add that capability to leanfront. I will probably get 
to it sometime. In the meantime what I do currently to change recording 
group in bash is this (see below). It is not recommended by the 
developers because database changes could invalidate this.

mysqlcmd="mysql --user=$DBUserName --password=$DBPassword 
--host=$DBHostName $DBName"
...
if [[ "$NEW_RECGROUP" == Deleted ]] ; then
     sql_extra=", autoexpire = 9999 "
else
     sql_extra=
fi
set -- `echo "select recgroupid from recgroups where recgroup = 
'$NEW_RECGROUP';" | \
     $mysqlcmd | tail -1`
recgroupid=$1
echo "update recorded set recgroup = '$NEW_RECGROUP',
       recgroupid = $recgroupid $sql_extra
       where basename = '$basename';" | \
     $mysqlcmd

basename is the recording file name. You could also use other parameters 
for the where clause but be careful in case it selects more records than 
you expect. You could change the rec group of an entire series by using 
the title in the where clause.

If you use invalid values for recording group bad things may happen.

Peter

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20211030/7e030563/attachment.htm>


More information about the mythtv-users mailing list