Plugin system for sites (Done)

You want a new feature? That's the place to talk about it.
zeek17
Posts: 8
Joined: Wed 7. Dec 2011, 10:29

Plugin system for sites (Done)

Post 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.
RedneckDrow
Posts: 70
Joined: Wed 23. Mar 2011, 16:19

Re: Plugin system for sites

Post 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.
User avatar
Raimond
Administrator
Posts: 293
Joined: Sat 20. Nov 2010, 13:31
Contact:

Re: Plugin system for sites

Post 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
RedneckDrow
Posts: 70
Joined: Wed 23. Mar 2011, 16:19

Re: Plugin system for sites

Post 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.
User avatar
Raimond
Administrator
Posts: 293
Joined: Sat 20. Nov 2010, 13:31
Contact:

Re: Plugin system for sites

Post 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
User avatar
Raimond
Administrator
Posts: 293
Joined: Sat 20. Nov 2010, 13:31
Contact:

Re: Plugin system for sites

Post 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
bitpoet
Posts: 3
Joined: Mon 5. Mar 2012, 18:44

Re: Plugin system for sites

Post 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
User avatar
Raimond
Administrator
Posts: 293
Joined: Sat 20. Nov 2010, 13:31
Contact:

Re: Plugin system for sites

Post 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
bitpoet
Posts: 3
Joined: Mon 5. Mar 2012, 18:44

Re: Plugin system for sites

Post 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
bitpoet
Posts: 3
Joined: Mon 5. Mar 2012, 18:44

Re: Plugin system for sites

Post by bitpoet »

And as promised, the version that takes bother story and chapter links: http://dl.dropbox.com/u/66766320/hpfanf ... ipt_v2.zip
Post Reply