MaeLyrica/How to write plugins: Difference between revisions

From Maemo Wiki
Jump to navigationJump to search
imported>marmistrz
added parse() doc
imported>marmistrz
 
Line 14: Line 14:


=== Requirements for functions ===
=== Requirements for functions ===
==== toProviderCode ====
The toProviderCode function should return the URL as std::string, from which data should be downloaded. The default download function will follow any redirects.


The toProviderCode function should return the URL as std::string, from which data should be downloaded. The default download function will follow any redirects.
==== parse ====


The parse function should save the plain text lyrics to variable
The parse function should save the plain text lyrics to variable

Latest revision as of 08:09, 23 August 2012

How to write a plugin for MaeLyrica?

What is a MaeLyrica plugin?

A MaeLyrica plug-in is a class inheriting a lyricsDownloader class

Which data should be provided?

A MaeLyrica plug-in is just a class containing these functions and variables:

   virtual std::string toProviderCode(string artist, string track) const;
   virtual bool parse();

The following function can be provided too:

   virtual short perform(string a, string t);
   virtual CURLcode download(string a, string t); 

Requirements for functions

toProviderCode

The toProviderCode function should return the URL as std::string, from which data should be downloaded. The default download function will follow any redirects.

parse

The parse function should save the plain text lyrics to variable

   QString lyrics_qstr;

which is a member of lyricsDownloader

The non-parsed text downloaded by the default download function is available in a variable, a member of lyricsDownloader

   std::ostringstream buff