tel8618217223380 / sagetv-addons

Automatically exported from code.google.com/p/sagetv-addons
0 stars 0 forks source link

Add Event Based Job Queueing #218

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It just struck me that we should add "Event Based" Task queueing.  Just as we 
have "Time Based" (crontab) Tasks we could have event based Tasks.  This way 
users could specify Tasks to execute when certain SageEvents occur 
(RecordingStarted, RecordingStopped, FavoriteAdded, MediaFileRemoved, etc.) I 
vision this as an option on the main menu along with the other items we already 
have.

I set this as a low priority item only because we are so far along, but the 
more I think about it the more useful I think it would be.

Opinion?

Original issue reported on code.google.com by tom.mira...@gmail.com on 6 Nov 2010 at 8:09

GoogleCodeExporter commented 9 years ago
We already have event based queuing! :)

Take a look at the plugin config options for SJQ... you can queue tasks for 
RecordingStarted, MediaFileImported and SystemMessagePosted events.  Also, you 
can specify tasks to queue on a per favourite basis (that's what we attach task 
ids to favs for).  You can also attach task ids to manual recordings.  
Attaching tasks to favs or manual recs only queue those tasks on the 
RecordingStarted event for that specific fav/man recording.

Everything I describe above should be working, if it's not then open tickets 
for specific issues.

I'm waiting for public beta testing to get a feel for what other events users 
are wanting to attach tasks to.  Adding support for any/all events in the SJQ 
engine is rather trivial - the real work is in the STV.  I didn't want to 
overload you with all kinds of events to handle.  We handle what I call "the 
big three" already (recording started, media imported, system message posted).  
User feedback will determine how many more we add support for.

Original comment by de...@battams.ca on 7 Nov 2010 at 3:30

GoogleCodeExporter commented 9 years ago
I saw those settings in the config options and I guess it never sunk in :(  
Personally, I'd like to see all possible SageEvents handled.  We could start by 
providing the simple list interface you already have in the config options.  To 
avoid clutter in the options maybe you could make them "advanced options" that 
only get displayed if the user enables that. (That's what I do in 
CommercialDetector.)

I can start working on a more user friendly interface and see if we can get it 
done in time for the public beta. The STV code will not be too hard to do.  I 
imagine it working like this:

A dialog appears listing all registered tasks.  Clicking on one of the tasks 
pops up another dialog that lets the user pick what events will fire that task.

So if the user wants to "view by event" they go to the plugin config options 
and use the list format you already have.  If they want to "view by task" they 
use the option from the main menu.

Original comment by tom.mira...@gmail.com on 7 Nov 2010 at 10:50

GoogleCodeExporter commented 9 years ago
Hey, if you're willing/wanting to add this level of support to the STVi then 
I'm definitely more than willing to make the necessary code changes in the 
engine to support it. :)

If we're going to allow selecting of specific events then basically we're going 
to have to change what we do now.  Now, we just use the generic property 
"SJQ4_TASKS".  We'll have to change this to specific props like 
"SJQ4_RecordingStarted", "SJQ4_RecordingCompleted", "SJQ4_RecordingStopped", 
"SJQ4_<eventName>", etc. and each time an event occurs SJQ will lookup the 
specific event property of the favourite and queue those tasks.

This is a little bit of work for me, but not much and all rather trivial.  If 
you want to tackle the STVi portion then I'll definitely make the engine 
changes.  So the fate of this ticket it really up to you. :)

Original comment by de...@battams.ca on 7 Nov 2010 at 1:24

GoogleCodeExporter commented 9 years ago
Let's give it a try.  If we don't get it working in time for the public beta 
we'll delay it.

Just to be clear, for this ticket I'm talking about tasks that do NOT relate to 
specific sage Objects.  The other ticket was the one that dealt with specific 
Favorites.

Original comment by tom.mira...@gmail.com on 7 Nov 2010 at 1:30

GoogleCodeExporter commented 9 years ago
One more thought.  Please provide an API that supplies me with a list of 
SageEvents that you will support.  I don't want to make the assumptions in the 
STV and hardcode all of the SageEvents.

Original comment by tom.mira...@gmail.com on 7 Nov 2010 at 1:47

GoogleCodeExporter commented 9 years ago
public String[] getSupportedEvents();

That is a String[] containing the list of all events the engine is currently 
listening for.  This method is available in DataStore for the next build.

Original comment by de...@battams.ca on 7 Nov 2010 at 2:34

GoogleCodeExporter commented 9 years ago
Nice.  Also let me know what method to use to associate a Task with one of 
these events.  I imagine it will be something like:

addTaskToEvent(Task, Event)

The STV code for this is actually very easy - I have most of it written already.

Original comment by tom.mira...@gmail.com on 7 Nov 2010 at 2:48

GoogleCodeExporter commented 9 years ago
Hmm... now I'm not so sure we're on the same page. :)  How/where do you plan to 
put this in the STV?  I guess I need you to describe how you're thinking of 
supporting this?

Original comment by de...@battams.ca on 7 Nov 2010 at 3:04

GoogleCodeExporter commented 9 years ago
I'll supply you with an updated STV in a few hours, that will make it clear.

Original comment by tom.mira...@gmail.com on 7 Nov 2010 at 3:13

GoogleCodeExporter commented 9 years ago
Included in the 1108 build.

Original comment by tom.mira...@gmail.com on 9 Nov 2010 at 8:16

GoogleCodeExporter commented 9 years ago
Fix verified.

Original comment by de...@battams.ca on 14 Nov 2010 at 2:53