Alpha PVR reminder
#1
Hey,

So as promised over on the Request Feature forum, I've been working on a PVR reminder, in other words a way of reminding you of a programme of interest on LiveTV that it's about to start.

I've created an addon to deal with this, currently the functionality is simple and limited, my knowledge of python was and probably still is somewhat limited.... But I'm getting there!

How does this work

When viewing Kodi's EPG, use the context menu (I've set "show context menu" as default in Kodi' settings) a "Remind me" option is then shown. By selling "remind me" when a valid programme is selected the time will be stored and a pop up will be shown to remind you that the programme is about to start.

settings

Settings are quite basic at the moment, the only option is to increase the amount of time the reminder is advanced e.g default is 5 minutes before programme starts. Maximum is 60 minutes.

limitations

As previously mentioned, this is quite basic at the moment, current limitations are:

Reminders
  1. Reminders can on be set in a 24hr day, eg if you set a reminder for 24:01 then this will be seen as this morning and not tomorrow morning, this is purely because i haven't dealt looked in to how to deal with dates yet.
  2. Only the last reminded programme is saved, so if you turn off Kodi all previouse reminders apart from the last is forgotten.
  3. If a reminder is set, and is not actioned in that day it will still remind you the next day if the time you turn on Kodi is before the time in the reminder.
  4. There's no way to cancel a reminder, the only way to do this is to let it remind you!
  5. ive developed this with Kodi 16 [Jarvis], this should still work on other versions (certainly Kodi 15) although the remind me in the context menu will show on every screen where as it will only show on liveTV for Kodi 16.
  6. I have not considered any other language other than English, I will once I have a stable release.

Credits

thanks to remigius who developed the XBMC alarm clock addon to which I used as a basis for this addon.

I will continue to develop and improve this, I've tested for a week or so on my production Kodi and it seems to be behaving itself... Any issues please turn on Debug and attach a log http://kodi.wiki/index.php?search=Log&ti...l%3ASearch with a full description of what went wrong and I'll do my best to fix.

current version 1.3, can be downloaded from here:

https://www.dropbox.com/s/k1co5olle9a9e0...r.zip?dl=0

It is also on GitHub, but I need to update it first, will add a link soon..

Ta

Ash
Reply
#2
This is great, thanks a lot for your efforts.
I hope to find some time to play around with this, i am already looking forward to added features like switch-to-program ;-).

Great to see someone spending time on this much wanted feature. So thank you again, i will post findings as soon as i find some time to install this version!
Regards,

A.
Reply
#3
Thank you! Will test tonight!
Reply
#4
(2015-12-14, 09:28)Atreyu Wrote: i am already looking forward to added features like switch-to-program ;-).

Nice hint,Wink if it's possible i will implement it, not sure how to grab the LiveTV stream though....

On another note... I've just had a thought, I have a feeling the addon will break if your local settings for time is set in 12hr format, i've always used 24Hr and i'm thinking the AM/PM in the time string will mess up some stuff...

will look into this over the next couple of days...
Reply
#5
+1 on the switch-to-program feature.

Some extra ideas to this request is to display a popup to switch or record the program in case some other program is running your also interested in.

And something more difficult is to add a reminder icon in EPG overview, skin should support such.
Reply
#6
Quote:Nice hint,Wink if it's possible i will implement it, not sure how to grab the LiveTV stream though....
I was semi-joking ofcourse :-)
I can imagine you' d want to iron out some stuff that exist currently before adding stuff, but it would surely be a logical next step.

I am certainly not an expert in python, but most pvr addons ( i use dvblink) have the 'switch-to-program feature build-in. Maybe there's something you can derive from it?

Anyway, i think it's great that you took this on.
Hope to find some time to change my 24h- timezone and see what it does :-)

Cheers!
Reply
#7
(2015-12-14, 16:36)schumi2004 Wrote: +1 on the switch-to-program feature.

Some extra ideas to this request is to display a popup to switch or record the program in case some other program is running your also interested in.

And something more difficult is to add a reminder icon in EPG overview, skin should support such.

All good suggestions, btw :-)
Reply
#8
I installed your addon, but get a "PVR reminder error". I am running Kodi 16 Beta 3 dated Dec. 6, on Windows 7 64 bit. My PVR backend is tvheadend. I clicked on "remind me" button from the guide.

Log
13:53:07 T:2704 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: '30 PM'
Traceback (most recent call last):
File "C:\Users\Ron\AppData\Roaming\Kodi\addons\script.service.pvrreminder\contextmenu.py", line 34, in <module>
setreminderdata.setreminder(videoname, videostarttime, videodate)
File "C:\Users\Ron\AppData\Roaming\Kodi\addons\script.service.pvrreminder\reminders.py", line 65, in setreminder
if Reminderstuff.validtime(self, new_programmetime):
File "C:\Users\Ron\AppData\Roaming\Kodi\addons\script.service.pvrreminder\reminders.py", line 48, in validtime
starttime = now.replace(hour=int(hr), minute=int(mins), second=1, microsecond=0)
ValueError: invalid literal for int() with base 10: '30 PM'
-->End of Python script error report<--
13:53:22 T:3544 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: '00 PM'
Traceback (most recent call last):
File "C:\Users\Ron\AppData\Roaming\Kodi\addons\script.service.pvrreminder\contextmenu.py", line 34, in <module>
setreminderdata.setreminder(videoname, videostarttime, videodate)
File "C:\Users\Ron\AppData\Roaming\Kodi\addons\script.service.pvrreminder\reminders.py", line 65, in setreminder
if Reminderstuff.validtime(self, new_programmetime):
File "C:\Users\Ron\AppData\Roaming\Kodi\addons\script.service.pvrreminder\reminders.py", line 48, in validtime
starttime = now.replace(hour=int(hr), minute=int(mins), second=1, microsecond=0)
ValueError: invalid literal for int() with base 10: '00 PM'
-->End of Python script error report<--
Reply
#9
(2015-12-14, 20:41)Atreyu Wrote:
(2015-12-14, 16:36)schumi2004 Wrote: +1 on the switch-to-program feature.

Some extra ideas to this request is to display a popup to switch or record the program in case some other program is running your also interested in.

And something more difficult is to add a reminder icon in EPG overview, skin should support such.

All good suggestions, btw :-)
Maybe addon Nextup can inspire you?
It has xml files skins can use.
My python skills aren't great either but I'm willing to help with this if you're github repo is ready Wink
Reply
#10
as suggested before:
if you add
Code:
import time
# "now" in unixtime
now_unixtime = int(time.time())

# convert date in unixtime -> here 2015-12-14 22:30
# today @ 22:30
starttime = datetime.datetime(2015, 12, 14, 22, 30)
starttime_unix = time.mktime(starttime.timetuple())
you get the actual unixtime, which you can then compare to a program starttime/-date, when you convert it to unixtime also. Then it does not matter when the program starts (in the future). Then you have to use ListItem.StartDate also to get the startdate

My Python knowledge is very poor, so I can't help ...
Philips TV with Kodi 20.2 with IPTV --- Orbsmart 500 Android 21 alpha/beta as Online-radio/TV in the kitchen
Reply
#11
(2015-12-14, 20:59)clarkss12 Wrote: I installed your addon, but get a "PVR reminder error". I am running Kodi 16 Beta 3 dated Dec. 6, on Windows 7 64 bit. My PVR backend is tvheadend. I clicked on "remind me" button from the guide.

Log
13:53:07 T:2704 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: '30 PM'
Traceback (most recent call last):
File "C:\Users\Ron\AppData\Roaming\Kodi\addons\script.service.pvrreminder\contextmenu.py", line 34, in <module>
setreminderdata.setreminder(videoname, videostarttime, videodate)
File "C:\Users\Ron\AppData\Roaming\Kodi\addons\script.service.pvrreminder\reminders.py", line 65, in setreminder
if Reminderstuff.validtime(self, new_programmetime):
File "C:\Users\Ron\AppData\Roaming\Kodi\addons\script.service.pvrreminder\reminders.py", line 48, in validtime
starttime = now.replace(hour=int(hr), minute=int(mins), second=1, microsecond=0)
ValueError: invalid literal for int() with base 10: '30 PM'
-->End of Python script error report<--
13:53:22 T:3544 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: '00 PM'
Traceback (most recent call last):
File "C:\Users\Ron\AppData\Roaming\Kodi\addons\script.service.pvrreminder\contextmenu.py", line 34, in <module>
setreminderdata.setreminder(videoname, videostarttime, videodate)
File "C:\Users\Ron\AppData\Roaming\Kodi\addons\script.service.pvrreminder\reminders.py", line 65, in setreminder
if Reminderstuff.validtime(self, new_programmetime):
File "C:\Users\Ron\AppData\Roaming\Kodi\addons\script.service.pvrreminder\reminders.py", line 48, in validtime
starttime = now.replace(hour=int(hr), minute=int(mins), second=1, microsecond=0)
ValueError: invalid literal for int() with base 10: '00 PM'
-->End of Python script error report<--

I think you have just proved a possible bug that I highlighted in post 4 ! You can either change to 24hr or wait until I fix it...
Reply
#12
(2015-12-14, 22:06)Solo0815 Wrote: as suggested before:
if you add
Code:
import time
# "now" in unixtime
now_unixtime = int(time.time())

# convert date in unixtime -> here 2015-12-14 22:30
# today @ 22:30
starttime = datetime.datetime(2015, 12, 14, 22, 30)
starttime_unix = time.mktime(starttime.timetuple())
you get the actual unixtime, which you can then compare to a program starttime/-date, when you convert it to unixtime also. Then it does not matter when the program starts (in the future). Then you have to use ListItem.StartDate also to get the startdate

My Python knowledge is very poor, so I can't help ...

Yep, saw your suggestion, thanks, just hadn't had a chance to properly look at it yet. Cheers
Reply
#13
(2015-12-14, 21:17)schumi2004 Wrote:
(2015-12-14, 20:41)Atreyu Wrote:
(2015-12-14, 16:36)schumi2004 Wrote: +1 on the switch-to-program feature.

Some extra ideas to this request is to display a popup to switch or record the program in case some other program is running your also interested in.

And something more difficult is to add a reminder icon in EPG overview, skin should support such.

All good suggestions, btw :-)
Maybe addon Nextup can inspire you?
It has xml files skins can use.
My python skills aren't great either but I'm willing to help with this if you're github repo is ready Wink

Thanks for the offer, yeah I need to get GitHub in order, will let you know....
Reply
#14
I have tested the addon last night.
Basics work, i have had no issues as in crashes or otherwise.
Some thoughts:

- context menu item is present in every screen; i would say it only needs to be there if the context matches, i.e. only in guide screens. Very minor, i'd say
- reminder popup.Eventually, one would like to have the particular program/channel displayed. As it is now it only tells you that 'something's up'. I still had to see what it was that i found interesting earlier ;-). The best way would be to have it autoswitch to the pre-selected program unless the user cancels it (say, within 30 secs), or something along the line that has been suggested before, where the user is presented with a 'switch or record'. Option. That would mimic behaviour of commercial PVR solutions.Dunno about it's complexity, though...
Reply
#15
@AshG:
you can have a look here for a countdown-timer: https://github.com/enen92/service.sleept...service.py
It is line 229 - 256
Philips TV with Kodi 20.2 with IPTV --- Orbsmart 500 Android 21 alpha/beta as Online-radio/TV in the kitchen
Reply

Logout Mark Read Team Forum Stats Members Help
PVR reminder0