Kodi Community Forum

Full Version: Schedule Smart Playlists
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a way to schedule smart playlists?
I have been searching the forum and google and I could not find anything.

I would like my system so switch the playlists at specific times.
For example that it plays relaxing music in the morning and then at 10am it will change to something more up beat and so on.

I am using Kodi with Openelec on a Pi.

Does someone have an idea on how to get this to work?

Cheers,
David
Hi !

Have you find any solution or idea to schedule playlists ?
I'm lookinf for a solution to schedule audio files at precise day(s)/time, etc... but did not find anythings for now.

Maybe a simple ip notify method like a remote control can work ?
I was thinking to cron jobs with wget or somethink like that but it is not a good kodi way to do...
Before, it's better to look for a real addon with a real interface Smile

Many people use google features but my problem is i just can work on local solution !
Maybe it is probably possible to interact with the calendar or cal in all linux distributions ?

JL.
It is possible to build scripts (wiki) with built-in functions

But i have found this addon https://superrepo.org/fr/kodi/addon/scri...larmclock/...
This addon probably can not do all what i'm looking for but i found how to use cron jobs to run scripts Wink

Realy, i love life, KODI and Linux too ! Rofl
Could you share one of the scrips you are using and the command to set it up as cron?

I was thinking that this is maybe the wrong place to set this request.
Maybe it would be better to write a post in the "Feature Request" section.
Maybe a scheduling function could be implemented with smart playlists so that you could choose the what time and on which days of the week you want to play specific smart playlists.

EDIT: I have just opened a thread on the Feature Request section

http://forum.kodi.tv/showthread.php?tid=220874
Sorry, no script at this time, i'm just looking for a way to go.
Before, i spent time to understand openHab. I would like a more generalist software than Gira Home server in my home automation (with the KNX binding addon), dind some others protocols for my job or me and in the same time have a look on the xbmc/kody addon, pour le plaisir.
Maybe OpenHab can be usefull for a kodi scheduler (to heavy if this is the only reason) and maybe a basic (or not) remote control ? Smile

Good idea to call the community at the rescue and thanks because i would not have done; there is surely somebody with all the know how to make the right kodi addon it in a couple of hour !
But i read somewhere comments from peoples who don't need or don't find any uses of the function alarm.
At least, we are two now and sure, i will follow your thread too.

Have you tryed script service alarmclock ?
Realy, try the service alarmclock; it seem to be what we need !
Maybe not the most complete but i can start with it.
Why don't you take time to learn coding a bit and make it better ?
(2015-03-10, 12:57)[email protected] Wrote: [ -> ]Sorry, no script at this time, i'm just looking for a way to go.
Before, i spent time to understand openHab. I would like a more generalist software than Gira Home server in my home automation (with the KNX binding addon), dind some others protocols for my job or me and in the same time have a look on the xbmc/kody addon, pour le plaisir.
Maybe OpenHab can be usefull for a kodi scheduler (to heavy if this is the only reason) and maybe a basic (or not) remote control ? Smile

Good idea to call the community at the rescue and thanks because i would not have done; there is surely somebody with all the know how to make the right kodi addon it in a couple of hour !
But i read somewhere comments from peoples who don't need or don't find any uses of the function alarm.
At least, we are two now and sure, i will follow your thread too.

Have you tryed script service alarmclock ?

Thank you for suggesting the service alarm clock.
I downloaded it from the official Kodi repository and moded it a little bit so that I can set 8 Alarms instead of only 5.
Let me know if you need a copy.

One thing that would be nice if it would fade out and fade in when it changes the playlist with an alarm.
Right now it will just brutally cut the music and change it to the new playlist.

Cheers
In advance, thank you for your copy.

You are true, fade in/out would be great !
I have tryed System -> settings -> Music -> playback -> crossfade setting
But it's does not work.

it is necessary to make loops in the script and use SetVolume(percent[,showvolumebar])
But will it work ?

An other feature would be resume after alarm.

Cheers
I made a fork on github where you can download it and find the changes I made.

https://github.com/psysfaction/script.se...alarmclock

I am very new to coding and am just trying to figure out how to do changes in this add-on in some skins,

It would be good to be able to set that the alarm will lower the volume the system step by step over a few seconds to creeate a fade out of what ever is playing before the alarm starts.

I think something needs to be added to the "default.py" file before this line of code:

Code:
def _play(self, item, volume):
    xbmc.executebuiltin('SetVolume(%s)' % volume)
    xbmc.Player().play(item)

Do you know what lines of codes is needed to get the system to slowly lower the volume over a few seconds and then stop what ever is playing before executing the alarm?
Hi !

Good job creating a git branch !

Here is another thread to read: The scheduler

About fading:
It is possible to make simples loops like this:

(fade out)
Code:
for x in range (100, 0)
  set volume to x
  x = x-1

(fade in)
Code:
for x in range (0, 100){
  set volume to n
  n += 1

In those cases x is in percents and the step is 1 at once.
use x = x-5 need 20 steps, etc.
a range (20, 100) stop the loop when volume is = 20%

Better read this for the correct syntax Wink

But this way don use a duration for the fading and the execution duration depend of the CPU, charge, ... !
Using time in a while() loop is a good exercice Smile
https://www.google.be/search?q=python+ti...X1aq3UgrAP

You need a loop to fade out, start playing and a loop to fade in again.
This is not enought...
How fade out at the end of the playlist, resume and fade in again ?
This would use events handlers to work i think.
Or maybe simply remember in a variable what is currently playing at the beginning of the script if available ?
(2015-03-12, 17:55)[email protected] Wrote: [ -> ]Hi !

Good job creating a git branch !

Here is another thread to read: The scheduler

About fading:
It is possible to make simples loops like this:

(fade out)
Code:
for x in range (100, 0)
  set volume to x
  x = x-1

(fade in)
Code:
for x in range (0, 100){
  set volume to n
  n += 1

In those cases x is in percents and the step is 1 at once.
use x = x-5 need 20 steps, etc.
a range (20, 100) stop the loop when volume is = 20%

Better read this for the correct syntax Wink

But this way don use a duration for the fading and the execution duration depend of the CPU, charge, ... !
Using time in a while() loop is a good exercice Smile
https://www.google.be/search?q=python+ti...X1aq3UgrAP

You need a loop to fade out, start playing and a loop to fade in again.
This is not enought...
How fade out at the end of the playlist, resume and fade in again ?
This would use events handlers to work i think.
Or maybe simply remember in a variable what is currently playing at the beginning of the script if available ?

Its relatively easy to do what you want, but you would need to make your own python script or kodi addon to handle it.

I'd recommend using XBMC's built in functions http://kodi.wiki/view/List_of_built-in_functions, if you want to get more advanced use json api instead.

You can set while loops to fade volume, then queue playlists at scheduled times. Once you get started if you need help, post code here... and I can help you out Smile
Thank you for all the help.
I am currently abroad and will not be able to do any testing for the next 10 days.

I will see If I'll be able to do it with your help since I am quite new to this.

Greetings from Thailand
Not sure how hard this was to add 3 alarms, but any plans to increase # alarms significantly to create more automation of music play throughout the week? ...say to 20 or so.