Cron XBMC - Help Wanted

  Thread Rating:
  • 1 Votes - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
robweber Offline
Posting Freak
Posts: 918
Joined: Sep 2009
Reputation: 27
Post: #1
I've started writing an addon that will be a growth of the current XBMC Library Updater addon. Basicaly rather than just update your library, I want to make an addon that will let you schedule multiple XBMC functions to run via a cron-like scheduler. All of your timers can now be handled directly within XBMC.

Examples include:

Rebooting
Restart XBMC
Take a Screenshot
Run another Addon or Script
Play Media
Refresh RSS
Send a Notification
Set XBMC Volume
Update Music/Video Libraries

Additionally you can specifiy your timers to display an XBMC notification when they run. With most of the pieces were already in place from the updater addon I didn't think this would be too difficult.

Unfortunately I've come to the realization that my skills creating a GUI interface really suck. I was able to figure out some basic directory listing by looking at other addons but making dialogs for creating/editing the schedules is proving beyond my means. In short - I'm looking for someone with a little XBMC GUI experience to help polish this up.

What It Can Do So Far:

Right now I think I have most of the cron pieces done. There is a service that runs that will read in the cron file (an xml file) and run the various commands. I also wrote some utility methods to read and write jobs to the file (you can create new or edit existing). All of these functions are tested and work.

The cron jobs themselves are in an xml format

Code:
<job name="Job Name" expression="* * * * *" command="XBMCCommand()" show_notification="true/false" />

This will also allow some growth if we want to include other things via the GUI in time.

I also have a basic GUI started (see screenshot). I tried to modify the the RSS Editor addon dialog to serve as a job creator/editor, but this is where I got stuck.

Anyone interested in helping work on this project please send me a PM. Please only respond if you know something about the XBMC skinning framework, this is the part I need help with. I am going to create a GIT repo and upload all the code but want to get another person onboard before going through all the work. Personally I don't mind modifying the cron file manually, but I'd like to release this as an official XBMC addon and not finishing the GUI makes this kind of useless to the general public.

Thanks in advance to anyone interested!

Update - 4/22/2012

I've moved all the code for this addon to Github. I'm trying to consolidate all my projects there, plus it will be easier for someone to pick up with should anyone ever be interested. Everything in the release is exactly the same, just a new location.

Cron XBMC on Github - https://github.com/robweber/cronxbmc

[Image: screenshot014.png]
(This post was last modified: 2012-04-22 17:10 by robweber.)
find quote
robweber Offline
Posting Freak
Posts: 918
Joined: Sep 2009
Reputation: 27
Post: #2
I have to say I'm a little disappointed. Three days and over 100 views later no one seems interested in this type of idea; even after all the "how to automate" type requests that seem to pop up in the forum.

I'm posting a link to what I have coded so far. Hopefully someone will stumble on this and have the know-how to finish up the GUI portion and make it user friendly. As of right now (as reported above) you can certainly add your timers manually via the cron.xml file and view them in the Programs area of XBMC. I added a nextRun() function that will figure out how long until the next run time - may be useful for the GUI or some pop-up notifications.


If anyone is seeing this for the first time and finds it interesting I'd be happy to collaborate on making it better. If downloading - view the README document for information on how to setup the cron.xml file with the correct formatting.
(This post was last modified: 2012-11-05 16:05 by robweber.)
find quote
GJones Offline
Fan
Posts: 438
Joined: Nov 2009
Reputation: 0
Post: #3
I'm just getting familiar with modifying a few skins now, so I would be of limited use to you on the GUI. I am more adept at the coding side of things but you seem to have that covered.

Have you considered adding the ability to schedule an update for just one source? As an example, my tv shows are all set to update almost instantaneously based on that one directory getting an update. It would be nice, however, to update just the source I use for new movies. My other sources (older movies, tv shows, music videos) are larger and/or take longer to update with very little upside. Being able to schedule an update for just one directory/source would be of huge benefit.
find quote
HansMayer Offline
Senior Member
Posts: 170
Joined: Feb 2012
Reputation: 10
Post: #4
Code:
<job name="Job Name" expression="* * * * *" command="XBMCCommand()" show_notification="true/false" />
How about
Code:
<job name="Job Name" minute="*" hour="*" day="*" month="*" weekday="*" command="XBMCCommand()" show_notification="true/false" />
as you shouldn't have to consult a manual to use it.
find quote
robweber Offline
Posting Freak
Posts: 918
Joined: Sep 2009
Reputation: 27
Post: #5
@GIjones

That is exactly the type of thing this would be useful for. The UpdateLibrary command takes the type of library and can also take a path as parameters. You could set a task to update your active directories more often using that command.

@HansMayer

My intent with this was to have the GUI be good enough that the format of the xml filewas something the user will never see. Since I couldnt finish the GUI this code is released as is in the hopes of getting some people interested. I would not try such submitting this to the xbmc repo for users at large like this.

Having the user interface have options for minute, second, etc would work. The power of cron is really what drives this so I wouldn't want to make it too simple and lose that.
find quote
HansMayer Offline
Senior Member
Posts: 170
Joined: Feb 2012
Reputation: 10
Post: #6
robweber Wrote:@HansMayer

My intent with this was to have the GUI be good enough that the format of the xml filewas something the user will never see. Since I couldnt finish the GUI this code is released as is in the hopes of getting some people interested. I would not try such submitting this to the xbmc repo for users at large like this.

Having the user interface have options for minute, second, etc would work. The power of cron is really what drives this so I wouldn't want to make it too simple and lose that.
I don't understand. What exact functionality would be lost if you would divide the options to make the arguments more obvious? You could still use hour="*/1" and stuff like that.
find quote
robweber Offline
Posting Freak
Posts: 918
Joined: Sep 2009
Reputation: 27
Post: #7
HansMayer Wrote:I don't understand. What exact functionality would be lost if you would divide the options to make the arguments more obvious? You could still use hour="*/1" and stuff like that.

No functionality would be lost, but there really isn't anything to be gained either. In short, if the "common user" is never really going to interact with the cron.xml file; why do I care if they understand how a cron expression is put together. Separating out the minute,hour,day,month,day of week isn't really helping them any. If they don't understand cron (have to refer to consult another manual) they probably won't know enough to understand that minute="*/5" is any different than expression="*/5 * * * *", either way you have to know how cron works.

When referring to "lost functinoality" I meant the GUI interface should abstract the inner works enough that the user can easily setup their schedules, but yet be complicated enough that more complex situations can be handled. Below I used the settings.xml file to mock-up how a "create schedule" type window could work within the addon. I was dealing with the skinning limitations of the addon settings window here so it could look a lot nicer and possibly have more options.

The point here again being that this is what the typical user would see - the format of cron.xml doesn't matter. After hitting 'OK' to add the schedule it would be put into the correct expression format and saved.

[Image: cron_general.gif]

[Image: cron_timing.gif]

Hopefully this makes sense. I'm not trying to say that modifying the xml structure is a bad idea, just that it wasn't ever meant to be something the typical person would go mucking around with. It doesn't give any bonuses coding-wise either so there isn't really an upside.
find quote
Khendon Offline
Junior Member
Posts: 7
Joined: Mar 2010
Reputation: 0
Post: #8
Would love a addon like this for easy setup of tasks

Sadly tho I am of none to little use in any of the parts you need help
find quote
wilson.joe Offline
Fan
Posts: 449
Joined: Nov 2010
Reputation: 6
Location: Salem, Or
Post: #9
I'm really liking this idea. The least one has to drop to a terminal to configure things
the better. Keeping it simple for the average person, and leaving the rest to those
of us that enjoy making our lives a little more complicated..
find quote
LoL Offline
Senior Member
Posts: 128
Joined: Oct 2003
Reputation: 0
Location: The Netherlands
Post: #10
Just wanna say thx for this addon, works allready for me!
Hopefully for others it gets futher developed Wink

Was actually about to try and change your "XBMC Auto Library Updater" to auto restart my system... then found this Wink

Thx, LoL Wink
find quote
backspace Offline
Senior Member
Posts: 139
Joined: Mar 2012
Reputation: 1
Wink  RE: Cron XBMC - Help Wanted
Post: #11
I think this needs to be finished by some of the skilled skinner's out there Wink
I keep breaking xbmc trying different playlist options etc Confused

Anyone out there keen to finish the GUI?
find quote
robweber Offline
Posting Freak
Posts: 918
Joined: Sep 2009
Reputation: 27
Post: #12
(2012-04-03 03:54)backspace Wrote:  I think this needs to be finished by some of the skilled skinner's out there Wink
I keep breaking xbmc trying different playlist options etc Confused

Anyone out there keen to finish the GUI?

I agree, someone with some skinning talent is definitely needed here. I keep hoping as this thread gets bumped someone will notice it eventually and be willing to devote some time.

How are you breaking xbmc with the playlist options? Just trying stuff out and finding it isn't working?
find quote
backspace Offline
Senior Member
Posts: 139
Joined: Mar 2012
Reputation: 1
Post: #13
How I break xbmc... by changing stuff I have no knowledge about Big Grin... I must have deleted a line of code or something by accident and it would hang, but went back to the original version and it worked fine. And over lapping playlist ie 7am-11pm = playlist1, 3pm-5pm = playlist2, 8pm-10pm = playlist3 etc didn't seam to work. not sure why?
find quote
backspace Offline
Senior Member
Posts: 139
Joined: Mar 2012
Reputation: 1
Post: #14
Is there a way to make this clear the music play list before timing another?

Also still hoping that someone jumping and finish the GUI (please)
find quote
robweber Offline
Posting Freak
Posts: 918
Joined: Sep 2009
Reputation: 27
Post: #15
(2012-11-01 21:51)backspace Wrote:  Is there a way to make this clear the music play list before timing another?

Also still hoping that someone jumping and finish the GUI (please)

Since this is more of a timer and not something that reacts to an event (like a playlist finishing) I would say 'no'. I guess I need a better example of what you are trying to do though. It may be possible to write a script and call that on a timer to check for certain conditions, really just depends. If you can provide more info I'd be glad to make a suggestion.
find quote
Post Reply