PINSENTRY Add-on - Kodi 19 Support
#1
I have been trying to get the PINSENTRY Parental control app compatible with Kodi 19.  I am currently stuck with this strange message which i am unable to resolve. Any help will be much appreciated.

    def getNumberOfLevels():
        return int(ADDON.getSetting("numberOfLevels")) + 1


 return int(ADDON.getSetting("numberOfLevels")) + 1
  ValueError: invalid literal for int() with base 10: '' 

The reference to this in settings.xml as below. 
<setting id="numberOfLevels" label="32020" type="enum" values="1|2|3|4|5" default="0" />

PINSENTRY link

Regards
Enigmaa

mod edit - link removed
Reply
#2
Due to certain historic actions on his part, the author of that addon is banned from here, as are links to his repository.

The link above has been removed.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#3
(2021-05-03, 23:10)DarrenHill Wrote: Due to certain historic actions on his part, the author of that addon is banned from here, as are links to his repository.

The link above has been removed.

Thanks Darren. Since PINSENTRY is the only working Parental Control app in Kodi, appreciate some help to get the add-on ported to Kodi 19. The Author has already agreed to transfer the ownership and i am willing to get it supported. I have managed to port the code to 19 but getting stuck for the above error. Appreciate Kodi community's help on this.
Reply
#4
(2021-05-15, 06:41)enigmaa Wrote:
(2021-05-03, 23:10)DarrenHill Wrote: Due to certain historic actions on his part, the author of that addon is banned from here, as are links to his repository.

The link above has been removed.

Thanks Darren. Since PINSENTRY is the only working Parental Control app in Kodi, appreciate some help to get the add-on ported to Kodi 19. The Author has already agreed to transfer the ownership and i am willing to get it supported. I have managed to port the code to 19 but getting stuck for the above error. Appreciate Kodi community's help on this.

I'm using pin sentry since a few years and it's unavailability blocks me from updating to Kodi 19. I don't want too use Kodi's parental control feature because it's not convenient in my case. Is there any news regarding the ne‹ version of the add-on to Kodi 19?
Reply
#5
I'll move this to the addon development forum, as that may be a better place to get @enigmaa the help he needs to fix it up.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#6
The error message is stating that Python cannot convert ADDON.getSetting("numberOfLevels") to an integer.  There are a few possibilities for this but without seeing more code it is difficult to determine.  I'd do this to debug it:

def getNumberOfLevels():
        settingvalue = ADDON.getSetting("numberOfLevels")
        xbmc.log('The setting value is: ' + str(settingvalue), xbmc.LOGINFO)
        return int(ADDON.getSetting("numberOfLevels")) + 1

This will tell you what is being returned by ADDON.getSetting("numberOfLevels"). 

I am happy to help you finish the Kodi 19 conversion.


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#7
(2021-05-30, 11:18)DarrenHill Wrote: I'll move this to the addon development forum, as that may be a better place to get @enigmaa the help he needs to fix it up.

Greatly appreciated Smile
Reply
#8
One other thing I forgot to mention is that the settings format is still in Kodi 18 format vs. Kodi 19.  It should still work but if you are doing a port to Kodi 19 it is best to convert the settings format too.  Here's a thread on how to do it.  There's a great addon from the Kodi team you can install and it will convert your settings for you.  I'd suggest doing this before debugging the current error.  Lastly, I am not sue why the settings type is enum vs. labelenum .  labelnum seems to be more appropriate.   Maybe start with:

<setting id="numberOfLevels" label="32020" type=" labelnum" values="0|1|2|3|4|5" default="0" />

  see if that works then run the addon conversion for the settings.


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#9
(2021-05-03, 23:10)DarrenHill Wrote: Due to certain historic actions on his part, the author of that addon is banned from here, as are links to his repository.

The link above has been removed.
Are there any news for upgrading PinSentry to Kodi19?
What actions do you mean? I can't imagine that someone who created such important stuff did harm to anybodyHuh
A parental control addon is essential for any responsible parents!!!!
Reply
#10
Unfortunately he did - including stuff hidden within some addons which was definitely not welcome or acceptable.

To my knowledge, there is no work on any kind of fork of PinSentry or anything along the same lines.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#11
(2021-05-30, 15:16)jbinkley60 Wrote: One other thing I forgot to mention is that the settings format is still in Kodi 18 format vs. Kodi 19.  It should still work but if you are doing a port to Kodi 19 it is best to convert the settings format too.  Here's a thread on how to do it.  There's a great addon from the Kodi team you can install and it will convert your settings for you.  I'd suggest doing this before debugging the current error.  Lastly, I am not sue why the settings type is enum vs. labelenum .  labelnum seems to be more appropriate.   Maybe start with:

<setting id="numberOfLevels" label="32020" type=" labelnum" values="0|1|2|3|4|5" default="0" />

  see if that works then run the addon conversion for the settings.


Jeff
Thanks Jeff and much appreciate your help with this. The error seems to have resolved but when i run the settings convert.. getting the below
Quote:2021-07-21 10:34:08.010 T:1456    DEBUG <general>: ------ Window Deinit (DialogSelect.xml) ------
2021-07-21 10:34:08.028 T:7116    ERROR <general>: script.settings-convert: Warning: random "id" generated for setting {'label': '32007', 'type': 'action', 'option': 'close', 'action': 'RunScript($CWD/setpin.py)'}
2021-07-21 10:34:08.029 T:7116    ERROR <general>: script.settings-convert: Warning: random "id" generated for setting {'label': '32114', 'type': 'action', 'option': 'close', 'action': 'RunAddon(script.pinsentry)'}
2021-07-21 10:34:08.030 T:7116    ERROR <general>: script.settings-convert: Warning: random "id" generated for setting {'label': '32113', 'type': 'action', 'action': 'RunScript($CWD/cleanup.py)'}
2021-07-21 10:34:08.033 T:7116    ERROR <general>: script.settings-convert: Warning: random "id" generated for setting {'label': '32007', 'subsetting': 'true', 'visible': 'gt(-5,0)', 'type': 'action', 'option': 'close', 'action': 'RunScript($CWD/setpin.py,unrestrictedUserPin)'}
2021-07-21 10:34:08.035 T:7116    ERROR <general>: script.settings-convert: Warning: random "id" generated for setting {'label': '32007', 'subsetting': 'true', 'visible': 'gt(-10,0)', 'type': 'action', 'option': 'close', 'action': 'RunScript($CWD/setpin.py,user1Pin)'}
2021-07-21 10:34:08.037 T:7116    ERROR <general>: script.settings-convert: Warning: random "id" generated for setting {'label': '32007', 'subsetting': 'true', 'visible': 'gt(-21,1)', 'type': 'action', 'option': 'close', 'action': 'RunScript($CWD/setpin.py,user2Pin)'}
2021-07-21 10:34:08.039 T:7116    ERROR <general>: script.settings-convert: Warning: random "id" generated for setting {'label': '32007', 'subsetting': 'true', 'visible': 'gt(-32,2)', 'type': 'action', 'option': 'close', 'action': 'RunScript($CWD/setpin.py,user3Pin)'}
2021-07-21 10:34:08.041 T:7116    ERROR <general>: script.settings-convert: Warning: random "id" generated for setting {'label': '32007', 'subsetting': 'true', 'visible': 'gt(-43,3)', 'type': 'action', 'option': 'close', 'action': 'RunScript($CWD/setpin.py,user4Pin)'}
2021-07-21 10:34:08.043 T:7116    ERROR <general>: script.settings-convert: Warning: random "id" generated for setting {'label': '32007', 'subsetting': 'true', 'visible': 'gt(-54,4)', 'type': 'action', 'option': 'close', 'action': 'RunScript($CWD/setpin.py,user5Pin)'}
2021-07-21 10:34:08.103 T:1456    DEBUG <general>: ------ Window Init (DialogConfirm.xml) ------
Also i am getting the below 
Quote:2021-07-21 10:37:54.371 T:8044    ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'TypeError'>
                                                   Error Contents: 'iconImage' is an invalid keyword argument for this function
                                                   Traceback (most recent call last):
                                                     File "C:\Users\tkman\AppData\Roaming\Kodi\addons\script.pinsentry\plugin.py", line 803, in <module>
                                                       menuNav.showFolder(foldername[0], type1, subtype1)
                                                     File "C:\Users\tkman\AppData\Roaming\Kodi\addons\script.pinsentry\plugin.py", line 154, in showFolder
                                                       self._setList(MenuNavigator.MOVIES)
                                                     File "C:\Users\tkman\AppData\Roaming\Kodi\addons\script.pinsentry\plugin.py", line 194, in _setList
                                                       li = xbmcgui.ListItem(item['title'], iconImage=item['thumbnail'])
                                                   TypeError: 'iconImage' is an invalid keyword argument for this function
                                                   -->End of Python script error report<--
                                                   
Since i am very new to Python programming and i have been using Pinsentry for parental control, i am currently stuck with Kodi 18 as i have two young kids and need parental control for my movie library. I would very much appreciate if you can help to get this ported to Kodi 19. If you search for pinsentry in Github, you should be able to download the code. Robwest who owns the code has already agreed to get the ownership transferred ( check the issues column). I will be able to take ownership but porting to Kodi 19 seems a huge task with my limited Python skills.
Reply
#12
The error message is self-explanatory. There was some changes in Kodi Python API in v.19 so you need to use the recent documentation.
Official docs: https://codedocs.xyz/AlwinEsch/kodi/grou...c633a20618
Unofficial docs: https://romanvm.github.io/Kodistubs/_aut...i.ListItem
Reply
#13
(2021-07-21, 12:02)Roman_V_M Wrote: The error message is self-explanatory. There was some changes in Kodi Python API in v.19 so you need to use the recent documentation.
Official docs: https://codedocs.xyz/AlwinEsch/kodi/grou...c633a20618
Unofficial docs: https://romanvm.github.io/Kodistubs/_aut...i.ListItem

Hi Roman
Understand i need to use SetArt(). Are you able to provide some example on how to use this. How do i change iconimage for the below with setart(). Appreciate your help with this.
Quote:ICON = ADDON.getAddonInfo('icon')
FANART = ADDON.getAddonInfo('fanart')

iconImage = 'DefaultAddonPVRClient.png'
                if pvrItem['thumbnail'] not in [None, ""]:
                    iconImage = pvrItem['thumbnail']
iconImage = ICON
                for flag in Settings.flags:
                    if flag['lang'] == lang:
                        iconImage = os_path_join(ICON_DIR, flag['icon'])

 
Reply
#14
Here's an example from my addon where I changed it between Kodi 18 and 19.  Maybe this will help.

Kodi 18

li = xbmcgui.ListItem('Refresh', iconImage=addon.getAddonInfo("path") + '/resources/media/refresh.png')

Kodi 19

    li = xbmcgui.ListItem('Refresh')
    li.setArt({'icon':addon.getAddonInfo("path") + '/resources/media/refresh.png'})

Note there are multiple types of setArt art values.  You are using thumbnail which is now  thumb.  You can also set multiple values like this as a dictionary:

li.setArt({'thumb': iconurl, 'poster': iconurl, 'icon': iconurl, 'fanart': addon.getAddonInfo("path") + 'fanart.jpg'})



Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#15
(2021-07-23, 21:00)jbinkley60 Wrote: Here's an example from my addon where I changed it between Kodi 18 and 19.  Maybe this will help.

Kodi 18

li = xbmcgui.ListItem('Refresh', iconImage=addon.getAddonInfo("path") + '/resources/media/refresh.png')

Kodi 19

    li = xbmcgui.ListItem('Refresh')
    li.setArt({'icon':addon.getAddonInfo("path") + '/resources/media/refresh.png'})

Note there are multiple types of setArt art values.  You are using thumbnail which is now  thumb.  You can also set multiple values like this as a dictionary:

li.setArt({'thumb': iconurl, 'poster': iconurl, 'icon': iconurl, 'fanart': addon.getAddonInfo("path") + 'fanart.jpg'})



Jeff
Thanks Jeff. Much appreciate and i am pretty much near the add-on loading without any error on Kodi 19. I need some help with the below error while setting PIN for the add-on
Quote: def encryptPin(rawValue):
        return hashlib.sha256(rawValue).hexdigest()

Error Type: <class 'TypeError'>
                                                   Error Contents: Unicode-objects must be encoded before hashing
                                                   Traceback (most recent call last):
                                                     File "C:\Users\tkman\AppData\Roaming\Kodi\addons\script.pinsentry\/setpin.py", line 126, in <module>
                                                       setPin()
                                                     File "C:\Users\tkman\AppData\Roaming\Kodi\addons\script.pinsentry\/setpin.py", line 66, in setPin
                                                       Settings.setPinValue(enteredPin, pinLevel)
                                                     File "C:\Users\tkman\AppData\Roaming\Kodi\addons\script.pinsentry\resources\lib\settings.py", line 309, in setPinValue
                                                       encryptedPin = Settings.encryptPin(newPin)
                                                     File "C:\Users\tkman\AppData\Roaming\Kodi\addons\script.pinsentry\resources\lib\settings.py", line 378, in encryptPin
                                                       return hashlib.sha256(rawValue).hexdigest()
                                                   TypeError: Unicode-objects must be encoded before hashing
I also see many places with utf encoding
Quote:        json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Addons.GetAddons", "params": { "type": "xbmc.python.pluginsource", "enabled": true, "properties": ["name", "thumbnail", "fanart"] }, "id": 1}')
json_query = unicode(json_query, 'utf-8', errors='ignore')
Also like this
videoItem['title'] = item['title'].encode("utf-8")
       Is this required in Kodi 19 and can i remove the highlighted text.
Reply

Logout Mark Read Team Forum Stats Members Help
PINSENTRY Add-on - Kodi 19 Support0