Release script.embuary.helper - a skin helper service / widgets alternative
Hi @sualfred, Firstly thanks both for your amazing skin and this amazing addon! I'm using the calc function in this addon to work out a percentage watched for Container(tvshows) and Container(seasons). In a certain scenario I'm getting an error message. Usually it works fine, but if I rapidly press back from seasons level (i.e. Seasons > TV Shows > Home) an error below triggers:

This is the button I'm using, which is then embedded in all my focused layouts in my controls, so that if the conditions are met, it will trigger a calculation each time I scroll to a new item in any of my views:

xml:

  <include name="HiddenFocusButton">
    <control type="button">
      <visible allowhiddenfocus="true">false</visible>
      <animation effect="slide" end="0,0" time="380" reversible="false">Focus</animation>
      <onfocus condition="System.HasAddon(script.embuary.helper) + !String.IsEmpty(ListItem.Label) + !String.IsEqual(ListItem.Overlay,OverlayWatched.png) + [Container.Content(tvshows) | Container.Content(seasons)]">RunScript(script.embuary.helper,action=calc,do='"($INFO[ListItem.Property(WatchedEpisodes)] / $INFO[ListItem.Property(TotalEpisodes)]) * 100"',prop=MyResult)</onfocus>
      <onfocus condition="System.HasAddon(script.embuary.helper) + !String.IsEmpty(ListItem.Label) + [Control.IsVisible(500) + Container.Content(episodes) + !Skin.String(DetailedListView_Display,Square)]">RunScript(script.embuary.helper,action=calc,do='"($INFO[Container.TotalWatched] / $INFO[Container.NumItems]) * 100"',prop=MyResult)</onfocus>
      <onunfocus condition="!String.IsEmpty(Window(Home).Property(MyResult))">ClearProperty(MyResult,home)</onunfocus>
    </control>
  </include>

And this is the error in the log:

xml:

2020-01-30 14:51:34.898 T:123145536561152   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.SyntaxError'>
                                            Error Contents: invalid syntax (<string>, line 1)
                                            Traceback (most recent call last):
                                              File "/Users/ahekmat/Library/Application Support/Kodi/addons/script.embuary.helper/default.py", line 43, in <module>
                                                Main()
                                              File "/Users/ahekmat/Library/Application Support/Kodi/addons/script.embuary.helper/default.py", line 19, in __init__
                                                self.getactions()
                                              File "/Users/ahekmat/Library/Application Support/Kodi/addons/script.embuary.helper/default.py", line 39, in getactions
                                                util(self.params)
                                              File "/Users/ahekmat/Library/Application Support/Kodi/addons/script.embuary.helper/resources/lib/utils.py", line 180, in calc
                                                result = eval(str(formula))
                                              File "<string>", line 1
                                                ( / ) * 100
                                                  ^
                                            SyntaxError: invalid syntax
                                            -->End of Python script error report<--
 

Here's my whole error log if it's useful: https://www.dropbox.com/s/209sdqjquwyipts/kodi.log?dl=0
And full code here: https://github.com/realcopacetic/skin.copacetic

I'd be super grateful if you could see anything I've done wrong? Thanks!
Reply


Messages In This Thread
RE: script.embuary.helper - a skin helper service / widgets alternative - by realcopacetic - 2020-01-30, 17:02
Logout Mark Read Team Forum Stats Members Help
script.embuary.helper - a skin helper service / widgets alternative3