[mythtv] Re: [mythtv-commits] Re: Ticket #303: Some code to guess
the category of an insert cd/dvd
Leo Weppelman
leo at wau.mis.ah.nl
Sat Sep 10 07:55:48 UTC 2005
On Fri, Sep 09, 2005 at 08:11:02AM -0400, J. Donavan Stanley wrote:
> Leo Weppelman wrote:
>
> >I think you are missing the point... The difference is in the mediatype not
> >in the extension
>
> What the hell are you talking about?
Mmm, there obviously is a communiction problem here :-|
Maybe the new code will help illustrating the 'problem'. I updated the
code to use the setting table. The code now looks like:
//
// 2 functions to fetch the ExtensionMapList from the database.
//
void MythCDROM::BuildExtensionMapList(void)
{
NewExtensionMap("VideoExtensions", MEDIATYPE_MVIDEO);
NewExtensionMap("MusicExtensions", MEDIATYPE_MMUSIC);
}
void MythCDROM::NewExtensionMap(const QString& medianame, const int
mediatype)
{
ExtensionMap *eMap = new ExtensionMap;
eMap->Mediatype = mediatype;
eMap->Extensions = QStringList::split(",",
gContext->GetSetting(medianame), "");
if (eMap->Extensions.count() == 0)
{
cerr << "Empty setting for entry: " << medianame << endl;
delete eMap;
return;
}
ExtensionMapList.append(eMap);
}
As you can see from the above code, the BuildExtensionMapList() function
has the name ("VideoExtensions") and the #define (MEDIATYPE_MVIDEO) hard
coded. So if a _new_ module, say mythrecepy, is also storing files with
a certain suffix, you'll have to update the function with a line:
NewExtensionMap("RecepyExtensions", MEDIATYPE_MRECEPY);
to facilitate this.
You can get around this by not using gContext->GetSetting() but writing
a query that selects the '%Extensions" entry from the settings table and
insert the info of each row returned using NewExtensionMap().
This is what I tried to explain in my previous posting to this thread.
I'll do some more testing and I'll have to write de dbcheck code. I'll
send in a patch tonight.
Leo.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20050910/2d542469/attachment.pgp
More information about the mythtv-dev
mailing list