Kodi Community Forum

Full Version: script.embuary.helper - a skin helper service / widgets alternative
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 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
At some point it's getting hard to maintain Wink
This addon is a more a swiss army knife for skinners. A library maintaining tool or rating updater service is for end-users.

I have it in my mind and I'm looking forward for a new project. It's just a question of time. I'm starting a new job in the next few weeks and my wife is pregnant with our second monster. That's why I cannot give any timeframe when I'll start with it.
No worries man. My message was more like think out loud not in any way a request or demand.

Whatever time you need it's perfectly fine.

These stuff should be... bellow the bottom of your things to do list.

Cheers
Nessus
@nessus 

FYI

Image

Basics are already working. Next step is the .nfo updating.
Wow man!!!... just WOW!!!

When i said "whatever time" i dint mean one day...Shocked

Is this in github already?... how do i call it?
Only locally atm. Just added movies + tvshows. NFO updating is working as well. Just have to get the other stuff added.
Calling via RunScript() or via context menu. Works also on widgets.
Great... thanks a bunch man!!!

Will move on replacing the next stuff from script.skin.helper.service which brings me to my next question.

I use the select dialog form skin.helper.service on several places in Bello.
Some of them include also icons. Is this possible with your script?...
Image


Also i saw that the limit is 30 items. Can this be increased?.
As you can see in the image bellow in this one i use more than 30 items...
Image
@nessus 

I've increased it to 100 and extended the selectdialog feature to support the bigger one with label2 and icon:

Code:

<onclick>SetProperty(Dialog.1.Label,First element ListItem.Label)</onclick>
<onclick>SetProperty(Dialog.1.Label2,First element ListItem.Label2)</onclick>
<onclick>SetProperty(Dialog.1.Icon,First element ListItem.Icon)</onclick>
<onclick>SetProperty(Dialog.1.BuiltIn,ClearProperty(Foo,home)||SetProperty(Foo,bar,home)</onclick>
.....
<onclick>RunScript(script.embuary.helper,action=createselect,header=This is my heading,usedetails=true)</on

It's untested. Please let me know if it works. The changes are available on GitHub.
I dont know if am i doing something wrong but it's not working. I am getting only the Dialog.1.Label and Dialog.2.BuiltIn...

EDIT: Scratch that. I've miss the usedetails=true in the of the script call.

Everything working fine.


Cheers
Nessus
Tested your snippet and it works without any issues here.
xml:


                                <item>
                                    <label>usedetails test</label>
                                    <onclick>SetProperty(Dialog.1.Label,label1 1)</onclick>
                                    <onclick>SetProperty(Dialog.1.Label2,testlabel2 1)</onclick>
                                    <onclick>SetProperty(Dialog.1.Icon,DefaultVideo.png)</onclick>
                                    <onclick>SetProperty(Dialog.1.BuiltIn,Notification(test1,test1))</onclick>
                                    <onclick>SetProperty(Dialog.2.Label,label1 2)</onclick>
                                    <onclick>SetProperty(Dialog.2.Label2,testlabel2 2)</onclick>
                                    <onclick>SetProperty(Dialog.2.Icon,DefaultActor.png)</onclick>
                                    <onclick>SetProperty(Dialog.2.BuiltIn,Notification(test2,test2))</onclick>
                                    <onclick>RunScript(script.embuary.helper,action=createselect,header=$LOCALIZE[137],usedetails=true)</onclick>
                                </item>
                                <item>
                                    <label>nessus test</label>
                                    <onclick>SetProperty(Dialog.1.Label,$LOCALIZE[3])</onclick>
                                    <onclick>SetProperty(Dialog.1.Label2,$LOCALIZE[31381])</onclick>
                                    <onclick>SetProperty(Dialog.1.Icon,icons/videos.png)</onclick>
                                    <onclick>SetProperty(Dialog.1.BuiltIn,RunScript(script.globalsearch,movies=true&amp;tvshows=true&amp;episodes=true&amp;musicvideos=true))</onclick>
                                    <onclick>SetProperty(Dialog.2.Label,$LOCALIZE[2])</onclick>
                                    <onclick>SetProperty(Dialog.2.Label2,$LOCALIZE[31382])</onclick>
                                    <onclick>SetProperty(Dialog.2.Icon,icons/music.png)</onclick>
                                    <onclick>SetProperty(Dialog.2.BuiltIn,RunScript(script.globalsearch,artists=true&amp;albums=true&amp;songs=true))</onclick>
                                    <onclick>RunScript(script.embuary.helper,action=createselect,header=$LOCALIZE[137])</onclick>
                                </item>

Yea... my mistake.

What if i want to use a condition to hide one of the entries in case that a particular addon is not installed or (in some other use cases) if the library has content?

Maybe putting in the <onclick> Dialog.xx.BuiltIn will hide also the whole entry ?
Use a conditional onclick. It's enough to set "none" or "-" for the label. Setting these as fallback is used as identifier to proceed with the next items without stopping the creation.

Code:

<onclick condition="!Library.HasContent(movies)>SetProperty(Dialog.1.Label,none)</onclick>
<onclick condition="Library.HasContent(movies)>SetProperty(Dialog.1.Label,.....)</onclick>
<onclick condition="Library.HasContent(movies)>SetProperty(Dialog.1.BuiltIn,.....)</onclick>
That will mean double lines of code for both conditions... right?. Can we avoid that?

On another issue with this... if i run the script call from window and i want to close the window before the select dialog appears the script it's not running at all.
I've place the <onclick> close action after the script call and again the script it's running. Also i use your settimer function and still it's not running.
Any idea why?. The script.helper.service was working fine in that case.

xml:
<item id="15">
    <label>$LOCALIZE[31380]</label>
    <icon>icons/big/Media.png</icon>
    <onclick>SetProperty(Dialog.1.Label,$LOCALIZE[31370])</onclick>
    <onclick>SetProperty(Dialog.1.BuiltIn,UpdateLibrary(video))</onclick>
    <onclick>SetProperty(Dialog.2.Label,$LOCALIZE[31372])</onclick>
    <onclick>SetProperty(Dialog.2.BuiltIn,CleanLibrary(video))</onclick>
    <onclick>SetProperty(Dialog.3.Label,$LOCALIZE[31371])</onclick>
    <onclick>SetProperty(Dialog.3.BuiltIn,UpdateLibrary(Music))</onclick>
    <onclick>SetProperty(Dialog.4.Label,$LOCALIZE[31373])</onclick>
    <onclick>SetProperty(Dialog.4.BuiltIn,CleanLibrary(Music))</onclick>
    <onclick>RunScript(script.embuary.helper,action=createselect,header=$LOCALIZE[31380])</onclick>
    <onclick>Dialog.Close(PlayerControls)</onclick>
    <visible>[System.HasAddon(script.embuary.helper) + [Library.HasContent(Movies) | Library.HasContent(TVShows) | Library.HasContent(MusicVideos) | Library.HasContent(Music)]] + !Skin.HasSetting(UpdateLibrariesButton)</visible>
</item>
It could be avoided but I'm not sure if this will end up in a speed penalty. It's a loop and requests the window properties 100 times. Each request for them costs a few ms of time that's why I break the loop once label1 is empty.

Because the window properties get stored in the window you are setting them.
Why don't you just hide the other dialog if the select dialog gets visible via <visible>!Window.IsVisible(selectdialog)</visible>
You can also try to set a <onclick>Dialog.Close(all,true)</onclick> before. That works better with window animations for those scenarios.

Edit:
I also can offer you a argument to force the home window as property storage. But that requires a ",home" at each property setting. That could bypass your issue.
(2019-11-01, 21:22)sualfred Wrote: [ -> ]It could be avoided but I'm not sure if this will end up in a speed penalty. It's a loop and requests the window properties 100 times. Each request for them costs a few ms of time that's why I break the loop once label1 is empty.
I understand. No problem. I will see how can i bypass this. Maybe i will use some conditional includes for each set of actions and have them all gathered in one place/file for better maintaining.
 
(2019-11-01, 21:22)sualfred Wrote: [ -> ]Because the window properties get stored in the window you are setting them.
Why don't you just hide the other dialog if the select dialog gets visible via <visible>!Window.IsVisible(selectdialog)</visible>
You can also try to set a <onclick>Dialog.Close(all,true)</onclick> before. That works better with window animations for those scenarios.

Edit:
I also can offer you a argument to force the home window as property storage. But that requires a ",home" at each property setting. That could bypass your issue.
The <onclick>Dialog.Close(all,true)</onclick> works but usually i am avoiding it due the fact that it forces the closing of windows. I think storing the property on home window it's more proper approach since this it's a global function.  Is that make sense to you also?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28