Page 1 of 3

Plugin system for sites (Done)

Posted: Sun 26. Feb 2012, 23:15
by zeek17
Is there a way to create one? I'd like to download stories from other sources too, but they ain't in english and to others they would not be interesting. Heck, they'd be useless to most from my country too, so I don't bother asking to add sites for my sake only. And thus, if everyone could create plugins to download fics and whatnot, it'll helps greatly I think.

Re: Plugin system for sites

Posted: Thu 1. Mar 2012, 16:33
by RedneckDrow
I second the motion! You could even use something like Imagehostgrabber's host file editor, which allows users to input custom sites using regular expressions. That way, we could stop bugging you every time we wanted a website added.

Or use something similar to mozilla's plugin api to allow users to add their own specific functionality to the base program. Of course, that would probably mean having to shift to a semi open-source model, which I realize that you do not wish to do.

Re: Plugin system for sites

Posted: Thu 1. Mar 2012, 20:29
by Raimond
Hey,

a Plugin/Script interface is the reason for all of the internal changes during the last two releases.

https://qt-project.org/doc/qt-4.8/qtscript.html

Rai

Re: Plugin system for sites

Posted: Sat 3. Mar 2012, 16:23
by RedneckDrow
Qt is certainly a great GUI framework, and makes for easy porting to and from multiple OS platforms. I usually stick to using it or GTK+ when I'm coding for Linux.

Re: Plugin system for sites

Posted: Mon 5. Mar 2012, 13:59
by Raimond
Hi,

took much more time than i thought it would be.
http://dl.dropbox.com/u/13474460/script.7z

Write your regular expressions into the script.js file. (I put some examples for ff.net in there)
The script.exe shows the results so you can check if it's working corectly.
So, who's going to write the first script for a new page?

Rai

Re: Plugin system for sites

Posted: Tue 6. Mar 2012, 22:06
by Raimond
Hi again,

I've implemented the whole script part into the normal fanfictionDownloader application and wrote an example plugin for fanfiction.net
I'm surprised myself, but it worked without errors.

The Plugin-Creation-Helper is also updated to the latest script-layout file.
The script.js contains the fanfiction.net Example.
Link is still the same: http://dl.dropbox.com/u/13474460/script.7z

So, who's going to write the first plugin for a new website?

Rai

Re: Plugin system for sites

Posted: Tue 13. Mar 2012, 06:54
by bitpoet
I've toyed around with the plugin script a bit doing an implementation for hpfanficarchive.com, it looks like things are working in script.exe. Is it already possible to run use scripts inside calibre?

Here's the link: http://dl.dropbox.com/u/66766320/hpfanf ... script.zip

Re: Plugin system for sites

Posted: Tue 13. Mar 2012, 11:24
by Raimond
Hi bitpoet,

well done, it looks like it's working. I'll test it for real this afternoon.
I found one "problem": Your implementation requires the user to enter the link to the index page. It's not working if the chapterlink is entered.
All the other pages within the downloader normaly do it the other way around: they accept the chapterlink but not the index page.

To do it absolute perfect there's this way: (you are allowed to create your own script functions)
In AnalyseContent: Check if the sourcecode is a chapter or the index page. if it's the index page: call a function to analyse everything.
if it's a chapter: create/search the link for the index page and request it by using additonal infos. Then call your analyse function.

This script will never work with calibre, but with the net version of FanFictionDownloader.
(I'll send you a testversion with plugin interface later today)

Rai

Re: Plugin system for sites

Posted: Tue 13. Mar 2012, 17:09
by bitpoet
Thanks for the feedback Rai, and also for sharing your work. I'll change the script to accept both chapter and story links, shouldn't be that hard.

-Chris

Re: Plugin system for sites

Posted: Tue 13. Mar 2012, 19:43
by bitpoet
And as promised, the version that takes bother story and chapter links: http://dl.dropbox.com/u/66766320/hpfanf ... ipt_v2.zip