[RELEASE] - The Scheduler

  Thread Rating:
  • 2 Votes - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
giftie Offline
Skilled Python Coder
Posts: 2,364
Joined: Mar 2010
Reputation: 54
Location: Calgary, Alberta
Post: #1
I know I've been teasing a few people with the release of this addon - The Scheduler...

Where to get it....

Test version - Version 1.0.1 -> https://www.dropbox.com/s/19jarh5fnkg29o...-1.0.1.zip

What it does.....

This service add-on will allow you to trigger built in XBMC functions on a schedule. This can be extremely useful. The script offers three built-in function schedules and 10 customizable schedules. The three built-in function are Video Library update, Music Library update and cdART Manager functions. The 10 customizable can be any XBMC Built-in function

How to use it.....

The key to The Scheduler is its settings. The settings are accessible from the Settings > Addons > Enabled Add-ons(if enabled), or Disabled Add-ons(if disabled) > Services > The Scheduler > Configure. You will need to disable the add-on first before entering the settings. After the settings have been changed and saved. you then would Enable the addon.

The First setting screen you are presented with is the XBMC Library scheduling. From here you are able to have XBMC to automatically update your Video and Music libraries.
[Image: screenshot011.png]
You have two options here - Enable Video Library Scheduling and Enable Music Library Scheduling. These are both basic Library updates, nothing special, if something special is needed, then you will need to use the custom schedules.
Enabling the schedule opens the settings for that schedule:
[Image: screenshot007.png]
The settings shown are 'Type of schedule' and the timing factor of the schedule.

The available Types of schedules:

Daily - Happens once a day at a specified time(at 2am)
Weekly - Happens once a week on a specified day and at a specified time(ie Sunday at 2am)
Hourly - Happens at the specified hour interval(the selection is 1, 2, 4, 8, 12hrs)

The script uses a 24hr clock for simplicity, ie 1pm = 13:00, 2pm = 14:00, 12am = 00:00 )

Since this is an addon I created, of course I also built-in cdART Manager background functions. Smile

cdART Manager schedule settings:
The schedule is broken up into two sections, downloading and updating. Downloading is for scheduling the artwork to be downloaded in background. Updating is for scheduling the update of the add-ons database(also done in the background)

Downloading:
[Image: screenshot008.png]
The first two settings allow you to disable the function if one of the Libraries are in the process of being updated.
The next group of options sets the type of schedule.
The final option is the artwork download mode. The available modes are: All Artwork, cdARTs, Cover Arts, Fanarts, clearLOGOs, Artist Thumbnails, Artist Music Banners.

The final type of schedule is the custom type. There are 10 of these spaces available. They follow the same flow as the other schedules. The only difference is that you can set the built-in function.
[Image: screenshot010.png]
The Built-in script setting is where you would put the built-in function

An example of this is the RunScript function:
Code:
RunScript(script.cdartmanager,update)

This would call the cdART Manager in the update function. There are many add-ons that can be started with specific option. These are often posted on the add-on thread page.

The final part of the settings are some options(Extra Settings)
[Image: screenshot015.png]

The first option is to enable the default interval(15 minutes) that the add-on will look to see if another schedule is needing to be triggered. Disabling will bring an option to set the desired time(with a range of 1 to 60 minutes).
The last option is to enable File logging for the trigger points of the add-on it will log whenever the schedules are triggered, with a time and the actual built-in function.

[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]
For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script.
Cinema Experience
Cinema Experience Wiki
cdART Manager
fanart.tv


(This post was last modified: 2014-02-16 08:47 by giftie.)
find quote
giftie Offline
Skilled Python Coder
Posts: 2,364
Joined: Mar 2010
Reputation: 54
Location: Calgary, Alberta
Post: #2
for future use

[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]
For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script.
Cinema Experience
Cinema Experience Wiki
cdART Manager
fanart.tv


(This post was last modified: 2012-11-03 23:23 by giftie.)
find quote
giftie Offline
Skilled Python Coder
Posts: 2,364
Joined: Mar 2010
Reputation: 54
Location: Calgary, Alberta
Post: #3
For Future

[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]
For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script.
Cinema Experience
Cinema Experience Wiki
cdART Manager
fanart.tv


find quote
brabax22 Offline
Junior Member
Posts: 8
Joined: Apr 2011
Reputation: 0
Location: Germany
Post: #4
I tried to set a scheduler type "CDArt Manager Scheduled Update". I can only set a time if "Disabled during Music Library Scan" is enabled?!?

If I activate the scheduler plugin, i get following error:

Code:
07:51:33 T:3002051392   DEBUG: Process - Entering source directory /home/xxx/.xbmc/addons/service.scheduler
07:51:33 T:3002051392   DEBUG: Instantiating addon using automatically obtained id of "service.scheduler" dependent on version 2.0 of the xbmc.python api
07:51:33 T:2454252352   DEBUG: Thread Background Loader start, auto delete: 0
07:51:33 T:2454252352   DEBUG: Thread Background Loader 2454252352 terminating
07:51:33 T:3002051392   DEBUG: [service.scheduler] - Setting Settings Load Interval: 86400 seconds
07:51:33 T:3002051392   DEBUG: [service.scheduler] - cdart_manager_running: False
07:51:33 T:3002051392   DEBUG: [service.scheduler] - cdart_manager_update: False
07:51:33 T:3002051392   DEBUG: [service.scheduler] - Current Day: Sunday
07:51:33 T:3002051392   DEBUG: [service.scheduler] - Current Time: 07:51
07:51:33 T:3002051392    INFO: -->Python script returned the following error<--
07:51:33 T:3002051392   ERROR: Error Type: <type 'exceptions.AttributeError'>
07:51:33 T:3002051392   ERROR: Error Contents: Scheduler instance has no attribute 'cdart_update_time'
07:51:33 T:3002051392   ERROR: Traceback (most recent call last):
                                              File "/home/xxx/.xbmc/addons/service.scheduler/default.py", line 916, in <module>
                                                script.start()
                                              File "/home/xxx/.xbmc/addons/service.scheduler/default.py", line 910, in start
                                                self.schedule_check()
                                              File "/home/xxx/.xbmc/addons/service.scheduler/default.py", line 499, in schedule_check
                                                elif cdart_update and ( self.current_time > ( self.test_time( self.cdart_update_time, test_interval + self.cdart_update_delay ) ) and self.current_time < ( self.test_time( self.cdart_update_time, test_interval + self.cdart_update_delay + 2 ) ) and self.cdartmanager_running and not self.cdartmanager_update ):
                                            AttributeError: Scheduler instance has no attribute 'cdart_update_time'
07:51:33 T:3002051392    INFO: -->End of Python script error report<--

The update is not started on time.

When i try it via custom script schedule "Runscript(script.cdartmanager,update) and activate the plugin comes also the error:
Code:
07:57:42 T:3002051392   DEBUG: Process - Entering source directory /home/xxx/.xbmc/addons/service.scheduler
07:57:42 T:3002051392   DEBUG: Instantiating addon using automatically obtained id of "service.scheduler" dependent on version 2.0 of the xbmc.python api
07:57:42 T:3002051392   DEBUG: [service.scheduler] - Setting Settings Load Interval: 86400 seconds
07:57:42 T:3002051392   DEBUG: [service.scheduler] - cdart_manager_running: False
07:57:42 T:3002051392   DEBUG: [service.scheduler] - cdart_manager_update: False
07:57:42 T:3002051392   DEBUG: [service.scheduler] - Current Day: Sunday
07:57:42 T:3002051392   DEBUG: [service.scheduler] - Current Time: 07:57
07:57:42 T:3002051392    INFO: -->Python script returned the following error<--
07:57:42 T:3002051392   ERROR: Error Type: <type 'exceptions.AttributeError'>
07:57:42 T:3002051392   ERROR: Error Contents: Scheduler instance has no attribute 'cdart_update_time'
07:57:42 T:3002051392   ERROR: Traceback (most recent call last):
                                              File "/home/xxx/.xbmc/addons/service.scheduler/default.py", line 916, in <module>
                                                script.start()
                                              File "/home/xxx/.xbmc/addons/service.scheduler/default.py", line 910, in start
                                                self.schedule_check()
                                              File "/home/xxx/.xbmc/addons/service.scheduler/default.py", line 499, in schedule_check
                                                elif cdart_update and ( self.current_time > ( self.test_time( self.cdart_update_time, test_interval + self.cdart_update_delay ) ) and self.current_time < ( self.test_time( self.cdart_update_time, test_interval + self.cdart_update_delay + 2 ) ) and self.cdartmanager_running and not self.cdartmanager_update ):
                                            AttributeError: Scheduler instance has no attribute 'cdart_update_time'
07:57:42 T:3002051392    INFO: -->End of Python script error report<--
(This post was last modified: 2012-11-04 09:00 by brabax22.)
find quote
giftie Offline
Skilled Python Coder
Posts: 2,364
Joined: Mar 2010
Reputation: 54
Location: Calgary, Alberta
Post: #5
Sorry. Looks like some thing snuck through. I'll fix it sometime Sunday. Also for the cdart manager's update function to run, there should not be a music scan going on as it would cause problems.

[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]
For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script.
Cinema Experience
Cinema Experience Wiki
cdART Manager
fanart.tv


(This post was last modified: 2012-11-04 09:30 by giftie.)
find quote
giftie Offline
Skilled Python Coder
Posts: 2,364
Joined: Mar 2010
Reputation: 54
Location: Calgary, Alberta
Post: #6
Fixed a couple of errors, new test release available -> https://github.com/downloads/Giftie/serv....0.0.6.zip

[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]
For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script.
Cinema Experience
Cinema Experience Wiki
cdART Manager
fanart.tv


find quote
brabax22 Offline
Junior Member
Posts: 8
Joined: Apr 2011
Reputation: 0
Location: Germany
Post: #7
When i try to schedule "Enable CDArt Manager Scheduled Update" without scheduling download i get following error when activating the plugin:

Code:
06:44:41 T:2891926336   DEBUG: Instantiating addon using automatically obtained id of "service.scheduler" dependent on version 2.0 of the xbmc.python api
06:44:41 T:2891926336   DEBUG: [service.scheduler] - Setting Settings Load Interval: 86400 seconds
06:44:41 T:2891926336   DEBUG: [service.scheduler] - cdart_manager_running: False
06:44:41 T:2891926336   DEBUG: [service.scheduler] - cdart_manager_update: False
06:44:41 T:2891926336   DEBUG: [service.scheduler] - Current Day: Monday
06:44:41 T:2891926336   DEBUG: [service.scheduler] - Current Time: 06:44
06:44:41 T:2891926336    INFO: -->Python script returned the following error<--
06:44:41 T:2891926336   ERROR: Error Type: <type 'exceptions.AttributeError'>
06:44:41 T:2891926336   ERROR: Error Contents: Scheduler instance has no attribute 'cdart_update_cycle'
06:44:41 T:2891926336   ERROR: Traceback (most recent call last):
                                              File "/home/xxx/.xbmc/addons/service.scheduler/default.py", line 958, in <module>
                                                script.start()
                                              File "/home/xxx/.xbmc/addons/service.scheduler/default.py", line 952, in start
                                                self.schedule_check()
                                              File "/home/xxx/.xbmc/addons/service.scheduler/default.py", line 656, in schedule_check
                                                if self.cdart_update_cycle == 0 and self.current_day == self.cdart_update_day and not self.cdart_update_day_triggerd:
                                            AttributeError: Scheduler instance has no attribute 'cdart_update_cycle'
06:44:41 T:2891926336    INFO: -->End of Python script error report<--
(This post was last modified: 2012-11-05 07:48 by brabax22.)
find quote
giftie Offline
Skilled Python Coder
Posts: 2,364
Joined: Mar 2010
Reputation: 54
Location: Calgary, Alberta
Post: #8
Thanks for the details...

New version for test. 0.0.7 -> https://github.com/downloads/Giftie/serv....0.0.7.zip

[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]
For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script.
Cinema Experience
Cinema Experience Wiki
cdART Manager
fanart.tv


find quote
Ghostdivision Offline
Posting Freak
Posts: 754
Joined: Jan 2012
Reputation: 0
Post: #9
Thanks for this, looking forward to giving it a try.
find quote
brabax22 Offline
Junior Member
Posts: 8
Joined: Apr 2011
Reputation: 0
Location: Germany
Post: #10
Currently i saw this error in debug log:
Code:
16:48:34 T:2644597568   ERROR: Traceback (most recent call last):
                                              File "/home/xxx/.xbmc/addons/service.scheduler/default.py", line 872, in <module>
                                                script.start()
                                              File "/home/xxx/.xbmc/addons/service.scheduler/default.py", line 866, in start
                                                self.schedule_check()
                                              File "/home/xxx/.xbmc/addons/service.scheduler/default.py", line 597, in schedule_check
                                                elif self.custom1_cycle == 1 and ( self.current_time == self.custom1_time or ( self.current_time > self.custom1_time and self.current_time < ( self.test_time( self.custom1_time, test_interval + custom1_delay ) ) ) ) and not self.custom1_time_trigger:
                                            NameError: global name 'custom1_delay' is not defined
16:48:34 T:2644597568    INFO: -->End of Python script error report<--

Hope this helps to debug.
(This post was last modified: 2012-11-09 17:51 by brabax22.)
find quote
giftie Offline
Skilled Python Coder
Posts: 2,364
Joined: Mar 2010
Reputation: 54
Location: Calgary, Alberta
Post: #11
Thanks brabax22. Fixed in new release..

https://github.com/downloads/Giftie/serv....0.0.8.zip


Also, if you are using version 2.7.7 of cdART Manager, you don't need to build enable the script to build the database in the background anymore. Just set the cdART Mananger Update schedule and it will build a database if it is missing.

[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]
For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script.
Cinema Experience
Cinema Experience Wiki
cdART Manager
fanart.tv


find quote
Ghostdivision Offline
Posting Freak
Posts: 754
Joined: Jan 2012
Reputation: 0
Post: #12
Will these new versions that are fixed be able to be updated in xbmc itself at all? I dont always remember to check the forums.
(This post was last modified: 2012-11-24 08:10 by Ghostdivision.)
find quote
simonk83 Offline
Senior Member
Posts: 132
Joined: Sep 2011
Reputation: 2
Post: #13
So, can anyone tell me how I'd go about using this to run Artwork Downloader once a day Big Grin Just want to make sure I get the function right (not sure if AD is a script, addon or plugin)...

I think it's an addon, so RunAddon(id) (but how do I find out the id)

EDIT: Or is it: RunScript(script.artwork.downloader, mediatype=?, dbid=?)

as per http://wiki.xbmc.org/index.php?title=Add...Downloader ?
(This post was last modified: 2012-11-27 13:31 by simonk83.)
find quote
Lunatixz Offline
Posting Freak
Posts: 3,084
Joined: May 2011
Reputation: 54
Location: New York
Post: #14
(2012-11-27 13:23)simonk83 Wrote:  So, can anyone tell me how I'd go about using this to run Artwork Downloader once a day Big Grin Just want to make sure I get the function right (not sure if AD is a script, addon or plugin)...

I think it's an addon, so RunAddon(id) (but how do I find out the id)

EDIT: Or is it: RunScript(script.artwork.downloader, mediatype=?, dbid=?)

as per http://wiki.xbmc.org/index.php?title=Add...Downloader ?

Use RunScript(script.artwork.downloader)
find quote
simonk83 Offline
Senior Member
Posts: 132
Joined: Sep 2011
Reputation: 2
Post: #15
Thanks. Sounds like a certain someone may have blocked it, but I'll give it a go later.

There's not much difference from me manually running AD once a day, or letting something do it automatically. The only difference is an annoyance to me (and everyone else) really. The impact on the site is exactly the same.

I'm actually more likely to manually run the script more than once a day as my stuff comes in, whereas if it were automatic I'd just leave it be.

Ah well, not much we can do about that I suppose.
find quote
Post Reply