[mythtv] SpecialRecordingGroups hard coded IDs

mythtv mythtv at mdabbs.org
Thu May 2 16:02:01 UTC 2019


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;



More information about the mythtv-dev mailing list