Kodi Community Forum

Full Version: Sleep Timer (service.sleeptimer)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
Will do. Many thanks.
OK color me dim whit (read Slow on the uptake) I read every post and what i don't understand is will this now work when watching several episodes of lets say the big bang theory? or will the timer reset on each new episode see post 7? if you are taking votes here are my planks for the future.

active only during a given time range

provide a list on most likely used cmds to be used with "Execute custom cmd after playback stop" many of us wouldn't know where to start looking. I'm not lazy I just don't believe in reinventing the wheel.

Regardless I think the work you have both done is grand and deserve many kudos and thanks.. with that said

Many Kudos K K K K K K
and
Thank You

Jim
The cmds depends on the user and on the operating system..there are no usefull commands as it is a an advanced setting. You might want to shutdown the machine, close Kodi, shutdown some equipment on the local network, trigger a library update, etc,etc.
Just ask what you want to run and i am sure people here will give you a hand.
As for the first request, it is planned Smile
Ah and when you're running several videos it is a playlist..so it will stop playing every video. However the videos youve fully watched will be marked as watched which means the next time you play a playlist you'll have only the unwatched videos on the list (and the resume points saved automagically by Kodi itself).
(2015-09-26, 16:19)enen92 Wrote: [ -> ]Ah and when you're running several videos it is a playlist..so it will stop playing every video. However the videos youve fully watched will be marked as watched which means the next time you play a playlist you'll have only the unwatched videos on the list (and the resume points saved automagically by Kodi itself).

Big Grin Well I setup the sleep timer and for my use it is almost perfect, the addition that is coming to set a time it will be active will make it perfect. My wife watches TBBT every night to go to sleep but leaves the FireTV running until the next night. Now the unit is shut down when we wake up, So all I can say is "BRAVO"

Regards
Jim
I have a slightly different problem, I will play recording from a PVR backend or a location on my hard drive, and if I fall asleep, when the recording finishes it goes back to the playlist AND marks the recording as watched, and then just sits there with the list of recordings on the screen until I wake up (it dims after a time, but it is still there). What I would REALLY like is if the program ends and I don't respond for, say, 15 minutes, it would play a very loud sound that hopefully would wake me up long enough to shut everything down, and also offer me the option to mark the recording or video I was watching as unwatched (since I probably didn't get to see the end). Generally the only time I play unending streams is when I play soft music from a satellite station (through my PVR backend) and I don't really mind if that plays all night, since it's not using any of my Internet bandwidth. I just hate it when I wake up and realize Kodi's been displaying the same videos or recordings list for the last three or four hours. If you addon could play an alarm sound after it's sat there for a while (for example, when the screen dimmer has been active for 10 minutes and it's between 11 PM and 8 AM) that would be fantastic.
You can run a custom script when the stop is triggered (if u fail to cancel the dialog progress). That CMD can be a python script that does whatever you want. You can trigger Kodi functions from that script instead of having this functionality on the timer because it is in fact too specific.

If your functions should not run only when the sleep timer stop is triggered your request falls a bit out of the bounds of this addon.
Please see my signature line. What you are telling me is, it can't be done.
(2015-07-16, 00:58)Namerp Wrote: [ -> ]Is it possible to include an option that the sleep timer only checks for sleep at specific times ?

any news on this ? don't want annoy or something but really miss this function Smile
(2015-10-15, 17:44)Namerp Wrote: [ -> ]
(2015-07-16, 00:58)Namerp Wrote: [ -> ]Is it possible to include an option that the sleep timer only checks for sleep at specific times ?

any news on this ? don't want annoy or something but really miss this function Smile

Sorry for the huge delay, I have been extremely busy. Implemented it now:

https://github.com/enen92/service.sleept...221e323ffd

Please test it by installing this version: https://github.com/enen92/service.sleept...master.zip

Let me know if it is working okay and I will send the new version to the repo (probably on weekend)

cheers
(2015-10-12, 18:05)xbmclinuxuser Wrote: [ -> ]Please see my signature line. What you are telling me is, it can't be done.

Sorry for the late reply as well, unfortunately on tapatalk I am not able to read signatures.
What you suggest basically is a service that tracks for how long your screensaver is active (idle time) while tracking what you are watching, and if the idle time exceeds a given value then show a countdown timer and (if you don't answer) plays an alarm sound for you to shut everything down or to execute a customised action. That's doable and pretty easy to be honest.
The only thing that is not doable is the ability to set the recording as not watched as unwatched simply because there is no method to do that. If you were playing movies or tvshows that would be doable as well. For recordings, you can only get the information, not set (if you want the said functionality please open a feature request thread for a setRecordingdetails for the json api of kodi).

What you want only differs from this addon in the fact that, in case of sleep.timer the service only executes actions if the idle time exceeds a given value AND kodi it is actually playing anything.

But I can code your suggestion if you are interested (creating a different addon).
Update sent to the repository: version 2.0.3.
Should be available in the next couple of days.
any help? sleep.timer stopped working recently

Code:
14:14:32 T:1532572672   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.ValueError'>
                                            Error Contents: invalid literal for int() with base 10: '1414 PM'
                                            Traceback (most recent call last):
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/service.sleeptimer/service.py", line 310, in <module>
                                                service()
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/service.sleeptimer/service.py", line 113, in __init__
                                                kodi_time = get_kodi_time()
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/service.sleeptimer/service.py", line 81, in get_kodi_time
                                                return int(time_string)
                                            ValueError: invalid literal for int() with base 10: '1414 PM'
                                            -->End of Python script error report<--

EDIT: rolled back to 2.0.2 and everything working again OK.
My Sleep ? timer has also stopped working for me recently. Looked at the log file and on my android device and pretty much the same as the one above. It has also stopped on my 2 linux devices too.

Code:
03:12:17 T:1842444240 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<-- - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS! Error Type: <type 'exceptions.ValueError'> Error Contents: invalid literal for int() with base 10: '312 AM' Traceback (most recent call last): File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/service.sleeptimer/service.py", line 310, in <module> service() File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/service.sleeptimer/service.py", line 113, in __init__ kodi_time = get_kodi_time() File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/service.sleeptimer/service.py", line 81, in get_kodi_time return int(time_string) ValueError: invalid literal for int() with base 10: '312 AM' -->End of Python script error report<-- 03:12:30 T:1786167608 ERROR: Unable to activate the previous window 03:22:18 T:1920429280 NOTICE: Thread JobWorker start, auto delete: true
There is something wrong with the time conversion. I think there are 2 possibilities causing this:
1.
Code:
def get_kodi_time():
    am_pm = xbmc.getInfoLabel('System.Time(xx)').lower()
    system_time = xbmc.getInfoLabel('System.Time')
    hour = system_time.split(':')[0]
    minute = system_time.split(':')[1]
When the time format is e.g. "11:04 AM" then maybe minute is "04 AM" because it is split by ":".
or
2. line 75:
system_time = xbmc.getInfoLabel('System.Time') gives "11:04 AM", it should return "11:04"then replace it with
Code:
system_time = xbmc.getInfoLabel('System.Time(hh:mm)')
Pages: 1 2 3 4 5 6