[mythtv] SpecialRecordingGroups hard coded IDs
Peter Bennett
pb.mythtv at gmail.com
Tue Jul 16 17:45:27 UTC 2019
On 5/3/19 1:48 PM, mythtv wrote:
> On 5/2/19 11:02 AM, mythtv wrote:
>> On 5/2/19 9:46 AM, mythtv wrote:
>>> On 5/2/19 9:13 AM, Stuart Auchterlonie wrote:
>>>>
>>>> We already have the function GetRecgroupId, see [1]. Does that not do
>>>> what you were thinking of?
>>>>
>>>> [1] -
>>>> https://github.com/MythTV/mythtv/blob/master/mythtv/libs/libmythtv/recordinginfo.cpp#L1603-L1617
>>>>
>>>>
>>> That would work too, although I wanted to avoid using the String
>>> versions of the special groups because I thought I saw somewhere in
>>> the code that the String versions were trying to be phased out. So
>>> having the separate methods would avoid still using the string names
>>> outside of the recordinginfo class.
>>>
>>> I'm okay either way though. I'll defer to the wisdom of the existing
>>> dev team. If everyone has an aversion to more methods in the class,
>>> I could just call GetRecgoupId and pass the names in.
>>> _______________________________________________
>>> mythtv-dev mailing list
>>> mythtv-dev at mythtv.org
>>> http://lists.mythtv.org/mailman/listinfo/mythtv-dev
>>> http://wiki.mythtv.org/Mailing_List_etiquette
>>> MythTV Forums: https://forum.mythtv.org
>>
>> Or, maybe better yet, just one method to convert the
>> SpecialRecordingGroup enum to the actual ID, instead of assuming the
>> SpecialRecordingGroup *IS* the ID. So something like:
>>
>> uint RecordingInfo::GetSpecialRecgroupID(SpecialRecordingGroups group)
>> {
>> QString names[3] = { QString("Default"), QString("LiveTV"),
>> QString("Deleted") };
>>
>> return GetRecgroupID(names[group]);
>> }
>>
>> And renumbering the enum to start at 0:
>>
>> typedef enum {
>> kDefaultRecGroup = 0,
>> kLiveTVRecGroup = 1,
>> kDeletedRecGroup = 2,
>> } SpecialRecordingGroups;
>>
>> _______________________________________________
>> mythtv-dev mailing list
>> mythtv-dev at mythtv.org
>> http://lists.mythtv.org/mailman/listinfo/mythtv-dev
>> http://wiki.mythtv.org/Mailing_List_etiquette
>> MythTV Forums: https://forum.mythtv.org
>
> And here's a patch for consideration... (It's against fixes/29, sorry)
>
>
>
I would think that a smaller change would be for the code which
initially adds these special recording groups to the database to hard
code the values it adds as 1,2,3 instead of letting them auto-increment
and hope that 1,2,3 get used. This, however, would not help people who
are already in this situation.
For your situation, or users who already have wrong ids for these
groups, can you just update those groups in your database to 1,2,3 and
run some sql that updates the recorded table entries to use the 1,2,3
values?
A schema update could be done that makes these changes.
I have not looked at the code to see if there are any gotchas with this.
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20190716/e52a175a/attachment.html>
More information about the mythtv-dev
mailing list