January 23, 2007

Plugin Infastracture

In November it was Google who changed his site a bit and the result was that Lyrics couldn't be downloaded. Then I ve found out that freecovers needed login to download pictures and the Hi-Res downloading module could not work. (It can' t even now (TS/C v0.91) work).
I know that this is a fight i m gonna loose someday so i m building a new plugin architecture specially for downloading information.
Yesterday I ve transformed the GoogleLyrics Information Provider to work in my new interface (as an internal plugin) but it will be easily updated with an external dll.
I ve also built a new Hi-Res Covers plugin using the cdcovers.to search engine. It is very easy and i m planning to release the source code of it as an example of how to build such a plugin.
(cdcoversinfoprovider plugin in action)

I m expecting Amazon plugins, Wikipedia plugins, localized lyrics plugins to appear sometime.

WARNING:
1. Programming code follows.
2. The framework is under construction

Description:
The Interface that must be implemented is (currently):

class InfoProvider
{
public:
//An Info Provider May Support more that one service
virtual BOOL Init(CNetDownloader* pDownloader) = 0;
virtual BOOL CanHandle(ITEM_INFO_TYPE iit) = 0;
virtual BOOL RetrieveInfo(ITEM_INFO_TYPE iit, LPCTSTR JobInfo) = 0;
virtual BOOL GetInfo(ITEM_INFO_TYPE iit, std::tstring& info, std::tstring& source) = 0;
//Returns a const pointer. The user must copy this value immediate after
//receiving. Also this strings belongs to InfoProvider (Client should not try to delete it)
virtual LPCTSTR GetErrorString() = 0;
virtual LPCTSTR GetInfoProviderDetails(InfoProviderDetails ipd) = 0;
//Should be thread safe. Returns 0-100;
virtual UINT GetProgress() = 0;

};


CNetDownloader is a utility that TS/C Provides for easy & streamlined Web Downloading

No comments: