Ted

Meet ted! Your new way of downloading tv shows from the web!

Add your favourite tv shows to ted and ted will automatically download torrents of new episodes!
Tasklist

FS#283 - Make plug-in support for ted

Attached to Project: Ted
Opened by Jofo (JoFo) - Saturday, 10 October 2009, 14:29 GMT+2
Task Type Feature Request
Category Backend / Core
Status New
Assigned To No-one
Operating System All
Severity Medium
Priority Normal
Reported Version 0.971
Due in Version 0.98
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

It would be very useful if ted was able to support plug-ins. We could take a lot of the stuff that if now centrally localized and put them into a plug-in.

One has to think of:
- The way RSS feeds are handled (translation from rss url to torrent url)
- Where tv show information is retrieved
- Tv show schedules

We should come up with a way to do make this able in ted. Should plug-ins be "registered" or is putting them in the plug-in folder good enough? Is for example one of the questions.

This issue is mostly for the discussion on this subject.
This task depends upon

Comment by Joshua (josh) - Wednesday, 14 October 2009, 02:10 GMT+2
Plugins:

So far i have written some of the infrastructure for plugins, its made up of a couple of parts, some parts i have thought about but not looked into:
1. Basic Pugin Interface:
- defined basic Ted plugin interface named IPlugin, has things like plugin name, description, version, might add a url for more info
- plugins are actually just jar files with class files inside them, can include other files inside the jar, see below for my epguides.com idea of including an xml file in the jar

2. Plugin Loader:
- loads plugins, at the moment it just loads all plugins in a directory that match a plugin type: eg. ted plugins of type Schedule

3. Plugin Registry???
- looking at "registering" plugins, so people can disable plugins without removing them, maybe set preferred order for plugins

4. Plugin threads:
- This will impact the daemon/web ui, i think we need to figure out a way to create threads that can be monitored, ie if the web ui starts a search do how do we update the swing ui? at the moment i am only building for the swing ui, but trying to make it flexible

5. Schedule/show info plugins:
- I have created a plugin type for show info/schedule's that can:
A. Search - Search by show name
B. Info - Get show info, ie: description, start date, images
C. Schedule - get the shows schedule
D. Validate show id - this will be used for manually added/user modified shows, just checks that the input show id is valid for the plugin

- The interface between ted and the plugins i have used is a XML document, i did this because the plugin doesnt need to implement any of teds classes, allowing us to change ted without screwing up any plugins (hopefully), ted checks the input XML document against a predefined XSD (XML Schema Document) file, this XSD file will make it easy for people to build against.
- At the moment i have created plugins for TVRage.com and TheTVDB.com, both have XML webservices that provide search, info and schedule information. these services can retrieve the information for all the shows that are currently defined in Ted (except for Cops, but im working on that), it also allows ted to automatically add alot more shows.
- I have not written a plugin for epguides.com because they dont supply any xml webservices making search/info parts a problem, however i figured out a solution, but i dont like it because it requires ongoing maintenance by us:
- Epguides.com plugin Idea:
A. move show definitions from shows_clean.xml to a new xml doc stored inside the plugin, import further information ie: description, start date so that search and information can be retrieved locally (this is a problem because we will have to update the plugin to add shows)
B. only schedule info will be retrieved online
This will work but it will require ongoing maintenence to keep shows up to date, and i dont really wanna do all the data entry to move all the info from shows_clean.xml because im lazy.
- we could keep epguides built into ted, and keep the shows_clean.xml but i would like to see shows_clean.xml removed and just use plugins, make ted cleaner/require less maintenance

6: Show Add Dialog:
- have designed a new show add dialog that works like a wizard:
Screen 1: show name entry screen, enter the show name click search
Screen 2: search results screen, results that match the entered show name are displayed in a table
Screen 3: show info screen, full show info screen, users can add the show to ted or go back to the search.
- i like wizards, im sick i know, but this is nice, clean and not cluttered like the current add show dialog(no offence to whoever built that)

7: Show config dialog
- Need to implement a way to view/change individual plugin show id's from here

8: TedSerie class
- ted serie class and daily show class are a cluster fuck, these are going to need to be updated/changed to implement RSS feed plugins, anime series and deamon/web ui
- at the moment i have had to write a ShowInfo class to retrieve show information from plugins but i would like to just use TedSerie but i cant as i dont know the type of show until i get the info, at the moment ted knows if the series is a daily series or not BEFORE it creates the series because its defined in shows_clean.xml

9: RSS feed plugin:
- This is going to be big!!!
- will require new TedSerie as above
- a good opportunity to rewrite ted to make it more deamon/web ui friendly, this might mean changes to the existing swing ui, eg: rss parser at the moment update the status bar in the swing ui, deamon/ web ui wouldnt need this/couldnt do this.
- this links back to Point 4: TedThreads, gui independent way to monitor threads within ted, then update the gui, be it swing/web

10: Change the way ted loads
- to help implement deamon/ web ui with plugins a change to the way ted loads might be in order
- i was thinking a two step process of:
A. initalise ted, load plugins, config file, shows, check for updates
B. start swing ui/ deamon and/or web ui
- this will need some way to display any errors or info that was caused by the intialisation within the given ui, possibly triggered/stored in the new log setup

11: Tasks blocked
- I think these changes are going to block these tasks or at least impact them
FS#213 - Rewrite parser
FS#114 - Request show referral (might not be needed)
FS#227 - Support Anime shows
FS#282 - Spilt up shows_clean.xml
- I think that plugin support is going to be blocked by/ impacted/ impact on:
FS#258 - Start ted as a daemon
FS#287 - Make a web UI

Discuss that!!


Comment by Jofo (JoFo) - Wednesday, 14 October 2009, 22:53 GMT+2
Wow, big post :) I'll have a look at it in the coming days, don't have time for it anymore today.
Comment by Kenny (kenny) - Monday, 19 October 2009, 00:49 GMT+2
Wow that's a lot of info all at once.

As to a plugin interface. I'm not sure I see the point to a plugin interface for loading schedule/show information (#5). There isn't very many sources for information, and it'll likely be us that would have to write a new one. I'm all for a better interface between them though. I created the ted.guide package with the start of a tvdb implementation. With a better interface between then we could allow the user to select which sites they wanted to use to pull information (although most would never change it).

The only place I see where an external plugin interface might be useful is for parsing torrent sites. Allowing users to add more torrent sites could be useful. Again I think we first works towards a good solid interface between them. Only when we can easily add new crazy sites should we consider the API stable enough for external use.

That's all I can process right at the moment :)

Oh, and mstead is working on some separation in the UI to enable a webui. That should allow for a more 'listener' based interface, which will help with some of this as well.

As to #6. I love the idea. TheTVDB has a very good show search, so when I complete that we should easily be able to allow users to search for shows. We could tie this into 'show profiles' based on the information like length (again from TVDB), which would allow choosing the size easily.

Comment by Joshua (josh) - Wednesday, 21 October 2009, 02:15 GMT+2
Kenny, The reason i have gone with the plugins for schedules/show info is that after speaking with Roel we decided to use it as a "test run" for the RSS parser, plus it does make ted a little easier to maintain.

Once i have my svn access working im gonna create a branch for the plugins so everyone can have a look and we can discuss from there. the schedule plugins/search dialog is 95% there , it aint too pretty but its working.
Comment by Joshua (josh) - Monday, 02 November 2009, 07:43 GMT+2
I have created a branch on svn for plugins now, check it out and to build plugins you will need this attached project, it has the actual plugin code, there is a file HOW_TO_MAKE_PLUGIN.TXT read that on how to create the plugins.

Its all a bit rough at the moment but it does work, but there are a couple of notes:
**** this branch will probably destroy your shows.ted file, make sure u back it up first ****
**** search is not 100% atm, it does about 95% of shows but some it doesnt work with... eg House or Jon and Kate Plus 8
**** this isnt backwards compatible yet, it doesnt have anyway to automatically find any show id's for existing shows, it will only work with freshly added shows
**** if you get the info for a lot of shows it will blow up, i think it has to do with loading the xsl files but i havent looked into it yet.
**** images are coming soon, just haven't got round to doin' em yet

Let me know what you think...
Comment by Kenny (kenny) - Tuesday, 03 November 2009, 03:00 GMT+2
I took a poke through this, and I'm still not sold on the need for this now.

For example with tv episode information there's only three sources.

If we did move to a plugin interface, why not something already existing and well used, like osgi.

As for the actual implementation, the main issues I'm seeing with it is that data is passed around in XML. The search results are apparently an XML Document, there's XML transformations going on in the plugins.

We need to define our interfaces and model in actual objects. We could have them serialized to XML using JAXB, but pulling properties from XML is going to make the code base more fragile.

I think instead we should work towards a solid model and api in the current package.
Comment by Joshua (josh) - Wednesday, 04 November 2009, 03:51 GMT+2
I did have a version of the plugins that passed an object back, but the reason i ditched it was that it required includes within the plugin and i wanted to limit the amount of cross over between ted and the plugins. now it just passes an xml doc so if there are internal changes to ted its not goin to affect the plugin(unless the xml doc structure changes).

Like i said its rough, but its somewhere to start from.

I have actually been thinkin that we should just include the schedule parser within Ted, like you say, there are really only 3 sources for this info, it might be an idea to include these three sources in ted, but also allow plugins should people want to add/make them.
Comment by Roel (roel) - Wednesday, 04 November 2009, 12:31 GMT+2
I think I agree. For the schedule/show information, we have a limited amount of sources and we can provide those 'plugins' ourselves, within ted.
We should agree on some interface for these sources however, so that it can be easy to add/modify them (and maybe in the and also allow external plugins).

We now use tv.com, epguides and tvrage. We want to include thetvdb as well.

These sites all offer roughly the same kind of information. I think kenny already made a start with the ScheduleSource interface, but we might want to pull more info for shows from the sources. So as long as all these sources in ted have interfaces like: getScheduleForShow, getSummaryForShow, getImageForShow, , getSummaryForEpisode, getImageForEpisode.
Comment by Jofo (JoFo) - Wednesday, 04 November 2009, 20:26 GMT+2
One advantage of the plug in approach is that you could update the plug ins without having to update ted. Releasing ted always takes time and when you only have to update a plug in you could do this by letting ted download the plug in and replace it for you.
Comment by Joshua (josh) - Thursday, 05 November 2009, 00:36 GMT+2
Well a plugin interface is just moving the interface out of ted and into a stand alone file so its not that hard, but if kenny is working on building a ScheduleSource interface and im working on a plugin set up thats just wasting time.
So a decision needs to be made either way, I can see the benifits of moving to plugins (easier to update/cleaner code in ted) but then there arent alot of sources to use for scheduling (epguides, tvrage and thedvdb). There are also questions regarding some of the sources, epguides we cant search, tvrage only returns an image with the schedule, tvdb has duplicate info.

So im happy to do it either way, or kenny can do his ScheduleSource interface or we can join my code with kennys and make something.
Comment by Kenny (kenny) - Thursday, 05 November 2009, 02:05 GMT+2
With an object interface, I'd be more on board for a plugin interface. I mainly want to avoid XML objects.

There's still a lot to a plugin interface that hasn't been considered though. For example, we currently store the plugin-id (tvrage id, epguide name) in the tvserie. To separate and make these true plugins we need to decide how to store this information. Where does it live?

The configuration for plugins also needs to be considered. Can and how do you configure a plugin? We need to provide a plugin interface for configuration information so it'll work both directly and in the gwt version.

To Jofo: We could still separate the project into smaller jars, if releasing partial updates is something we'd like to support. For example we could have a ted-guide.jar that includes all the ted.guide stuff. We don't _need_ a plugin interface for this.
Comment by Jofo (JoFo) - Saturday, 07 November 2009, 11:11 GMT+2
> We could still separate the project into smaller jars, if releasing partial updates is something we'd like to support. For example we could have a ted-guide.jar that includes all the ted.guide stuff. We don't _need_ a plugin interface for this.
Okay, I do think this is then the way to go. Let's drop the plugin idea for now/ever and focus on separating the project in smaller jars. It might be nice if we could let ted do the partial updates but this would be a bonus.

: I'm sorry about the time you put into this. Still, can any of the code changes that you've made be used for the current idea?

: we might want to open a new issue for this to keep track of the progress/changes. Idea? Don't hesitate to create one :)
Comment by Joshua (josh) - Sunday, 08 November 2009, 23:28 GMT+2
Ok then we will ditch the plugins then, but what about the search interface are people happy for that to go ahead?
It wont be too much work to port that over so that it works with the schedule parser.
Comment by Jofo (JoFo) - Monday, 16 November 2009, 22:53 GMT+2
Sorry about the late reply, for some reason I overlooked your post.

> but what about the search interface are people happy for that to go ahead?
I think I kind of forgot what the search interface exactly is in this context. Could you quickly explain or point me to a post/mail where I can catch up with this? Is it on the pluginBranch btw? I tried to load that one today but I cannot run it as it gives all kind of errors.
Comment by Joshua (josh) - Tuesday, 17 November 2009, 03:12 GMT+2
Yeah the search is is the pluginBranch, what kind of error are you getting with that? I just checked it out on a clean pc and it worked fine for me.
As for what the search interface is, its a new Add Show Dialog that uses the search functionality of TVrage.com and theTVDB.com to add shows instead of relying on the shows_clean.xml file.
Comment by Jofo (JoFo) - Tuesday, 17 November 2009, 14:24 GMT+2
I got missing jar complaints (I'm not at work so I can't double check that at this moment). I just should import the top folder as a new Java Project in Eclipse right?
Comment by Joshua (josh) - Tuesday, 17 November 2009, 23:28 GMT+2
Yeah just import the top folder, eclipse will find the project ted, and thats should be it, let me know if its not
Comment by Jofo (JoFo) - Wednesday, 18 November 2009, 20:46 GMT+2
The problem was that the junit library was not in the build path. Fixed that.

I had a look at the search option but that doesn't work right? At least it didn't return any results for big show names.

Although I like the idea I would prefer to postpone it until the whole log system works properly. Currently the parse summary is unreadable. Any plans on having a look at that? Maybe I'll create a new issue for it and close this one.

Comment by Jofo (JoFo) - Wednesday, 18 November 2009, 21:48 GMT+2 Comment by Joshua (josh) - Wednesday, 18 November 2009, 23:27 GMT+2
Im working on the log table at the moment, should be fixed up soon.
As for the shows not working, did u have the plugins in the folder? because i have only found 3-4 shows in the current show list that dont work.
Comment by Jofo (JoFo) - Wednesday, 18 November 2009, 23:33 GMT+2
Which plugins in which folder? :)
Comment by Joshua (josh) - Thursday, 19 November 2009, 02:05 GMT+2
read above

Loading...