User Tools

Site Tools


development

Plugin Development

Plugin developers themselves. Don't forget - Quality is our advantage!

Necessary tools to start making plugin

I expect you are smart enough and you already know some programming languages. It can be painful for you - as for beginner, but you can nothing to lose, just to earn. So, JDK is here:

Working with SVN

Check my tutorials how to work with SVN:

but you can also use the integrated Version Control in IntelliJ IDEA.

A must with a plugin

Coding

  • Always handle possible error state IF-ELSE and throw exception in case of error

Releasing

  • Always test it using TestApp
  • Final working plugin add to a list in main build.xml in src folder - this build.xml is called when new FRD version is being released

Documentation

Tutorial videos

Javadoc

FAQ

  • Q: When commiting updated plugin, should I increase version in plugin.xml?
  • A: Yeah, always. The new number is up to you (it should usually reflect amount of changes you made)
  • Q: What should I input to PlugUtils.checkFileSize()? Apparently it needs the filesize in bytes (?) and I'm inputting it in megabytes.
  • Q: How to redirect URL of file to another URL
  • A:
this.httpFile.setNewURL(....); //to setup new URL
this.httpFile.setPluginID(""); //to run detection what plugin should be used for new URL, when file is in QUEUED state
  • Q: What's difference between ServiceConnectionException and YouHaveToWaitException
  • A: When ServiceConnectionException is throwed - FRD waits for user specific time (defined in User Preferences) - it can be repeated only X times, YouHaveToWaitException waits for specific time defined in plugin - URL can loop indefinitely then.
  • Q: How to use internal OCR Engine?
  • A: We use GOCR for this. Call PlugUtils.recognize . We call gocr.exe this way exec(“gocr.exe ” + commandLineOptions + “ -f ASCII -”);. You can use -i to test it directly from system. See gocr.exe -help for more details. Note: gocr.exe does not take jpg pictures or something like that. It's using PBM format - you can use Adobe Photoshop to generate this format.
  • Q: I have problems using non-ASCII characters (eg. Cyrillic, Arabian, Chinese, etc…) in plugins. Is there a workaround?
  • A: Press Alt+x after each character in Microsoft Word and add \u in front of each of them.
  • A2: Or use Unicode to Java string converter http://www.snible.org/java2/uni2java.html
  • Q: How to add more files into queue?
  • A:
    getPluginService().getPluginContext().getQueueSupport().addLinksToQueue(httpFile, uriList);

Knowns problems in current version of API

  • API cannot ignore two or more invalid variants of content-type (eg. plain/text something) using considerAsStream httpclient property
  • too many constants without descriptions like 'considerAsStream'

New feature suggestions

Web administration

Using Recaptcha in plugin

It's necessary to add dependency in plugin.xml after <attributes> section:

 <requires>
      <import plugin-id="recaptcha.com" plugin-version="1.0" match="greater-or-equal"/>
 </requires>

In build.xml: In target “compile” - javac task - add another sourcepath to /devapp

   <sourcepath location="../devapp"/>
   <sourcepath location="../recaptcha"/>

Then you can use cz.vity.freerapid.plugins.services.recaptcha.ReCaptcha plugin and call its methods. After that manual build plugin with Ant task should work properly.

CAPTCHA recognition

Here are some steps from my experience:
a) creating a training set

1. Trim every character from the picture, remove background color, probably with every same size

2. Build a structure many mappings characters' picture→character + convert character picture into black and white or gray

b) testing

1. extract every character from the captcha, trim, convert it into BW or gray

2. compare character against training set using Euclidean distance method -

I usually counted it this way: for all x,y on the same sized pictures -
Sum ( (picture1.point[x,y].value - picture2.point[x,y].value)^2) training pattern with lowest sum is the best matching picture against testing picture
See Netload.in CAPTCHA recognition or older versions of Bagruj recognition.

Other

development.txt · Last modified: 2012/07/11 12:46 (external edit)