[mythtv] Hacking on gamehandler.cpp in mythgame

Michael T. Dean mtdean at thirdcontact.com
Sun May 16 17:29:42 UTC 2010


On 05/16/2010 12:54 PM, Espen A. Fossen wrote:
> On 16.05.2010 18:05, Anthony Zawacki wrote:
>    
>> On 05/16/2010 05:45 AM, Espen A. Fossen wrote:
>>      
>>>    QRegExp multiDiskRGXP = QRegExp( "[0-4]$", Qt::CaseSensitive,
>>> QRegExp::RegExp);
>>>
>>> I have some Amiga games with more than 4 disks, so compensate for the
>>> number of disks in edited the regex to handle up to 9 disks, like this.
>>>
>>>    QRegExp multiDiskRGXP = QRegExp( "[0-9]$", Qt::CaseSensitive,
>>> QRegExp::RegExp);
>>>        
>> I'm not a myth developer, but I'd try "\d+$" as the string and see if
>> that addresses your issue of picking out numbers.  The up side is that
>> it should support a hundred or a thousand disks  (someone still have
>> Linux 0.97 that came on something like 125 disks if you included tex?!?)
>>      
> That worked great. Looks like the {2} didn't work at all, can't see why
> it shouldn't work. Is there some special escaping for this also? Had to
> use an extra \ for the \d (\\d)
>    
>>>    QRegExp multiDiskRGXP2 = QRegExp( "[0-9]{2}$", Qt::CaseSensitive,
>>> QRegExp::RegExp);
>>>
>>> Then make a check for this before checking for romname with 1 digit
>>> ending. The actual code looks like this:
>>>        
>> I don't know if additional updates would be needed...  Sorry if I sent
>> you off in the wrong direction...
>>      
> There are some additional issues to fix when matching more then one
> digit, but that I can fix.
>    

Might want to use a QRegExp::cap() approach and just have it capture the 
basename and the digits digits all at the same time as it's doing the 
match.  I haven't looked at the file, but from the section you posted, 
it looks like you could significantly simplify the parsing that way.  
There are several examples elsewhere in MythTV (including MythVideo).

Mike


More information about the mythtv-dev mailing list