Release script.skinvariables - Construct skin variables and perform other skin functions
#46
Version 1.1.25 now includes several options for skins to access standard Kodi dialogs such as DialogSelect, DialogConfirm and DialogExtendedProgressBar
https://github.com/jurialmunkey/script.s...UI-Dialogs

There are also options for advanced filtering of library and plugin directories:
https://github.com/jurialmunkey/script.s...irectories

And some other features such as audio/subs, retrieving detailed info via JSON RPC, and some skinshortcuts management features which will be documented in the wiki soon.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#47
Very nice additions jurialmunkey, thanks. I can nearly remove my skin's dependency on script.embuary.helper as a result. The only thing stopping its complete removal is it's text viewer - any chance of that being added in the future?

EDIT: I see you've added that as well.
Reply
#48
(2023-09-25, 10:01)Hitcher Wrote: Very nice additions jurialmunkey, thanks. I can nearly remove my skin's dependency on script.embuary.helper as a result.

Thanks.

Attempting to provide some functional equivalents of embuary.helper and toolbox functions since neither of those are maintained anymore. So if there are any features etc. you'd like to see, let me know. Happy to implement what I can as long as it doesn't require a background service or online lookup (want to avoid any background resource overhead).

One point of difference you'll note is that I often prefer to provide output via plugin:// paths in hidden containers rather than using scripts to set window properties (for example: splitting strings). I find that's generally a bit more flexible with what you can do in a skin, but happy to provide a scripted equivalent if there's ever a need for one.

Added some more documentation for some of the other tools:
https://github.com/jurialmunkey/script.s...nd-Helpers
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#49
It's unbelievable how useful skin.variables is becoming. Thanks for creating it! I had also dreamed that maybe some day I could replace the use of embuary helper in my skin, since as you say, it's a pity, but now is unmantained. I'll be using skin variables as a required addon for Omega, so if you ever feel like expanding skin variables, that would be great. The features that I currently use are (I'm adding the corresponding code lines as a reference):

https://github.com/sualfred/script.embua...ile-exists
xml:
RunScript(script.embuary.helper,action=lookforfile,file='$ESCINFO[ListItem.Path,,theme.mp3]',prop=theme_ready)

https://github.com/sualfred/script.embua...ode-string
xml:
RunScript(script.embuary.helper,action=encode,string='$INFO[ListItem.Album]',prop=EncodedAlbumName)

https://github.com/sualfred/script.embua...go-to-path
xml:
RunScript(script.embuary.helper,action=goto,path='"plugin://plugin.video.youtube/kodion/search/query/?q=$INFO[Container(10051).ListItem.Title]&search_type=videos"',target=videos)

https://github.com/sualfred/script.embua...le-add-ons
xml:
RunScript(script.embuary.helper,action=toggleaddons,addonid=script.cu.lrclyrics,enable=false)

https://github.com/sualfred/script.embua...#play-item
xml:
RunScript(script.embuary.helper,action=playitem,dbid=$INFO[Container(10051).ListItem.DBID])

https://github.com/sualfred/script.embua...s#play-all
xml:
RunScript(script.embuary.helper,action=playall,id=5822,method=shuffle)

https://github.com/sualfred/script.embua...ntext-menu
xml:
<onclick>SetProperty(Context.1.Label,$LOCALIZE[457] / $LOCALIZE[33063])</onclick>
<onclick>SetProperty(Context.1.BuiltIn,SetProperty(HideWall,True,home)||ClearProperty(AnimWall2,home)||SetProperty(MediaMenu,True,home)||SetFocus(9050))</onclick>
<onclick>SetProperty(Context.2.Label,$LOCALIZE[208])</onclick>
<onclick>SetProperty(Context.2.BuiltIn,SetFocus(586)||Action(Play))</onclick>
<onclick>SetProperty(Context.3.Label,$VAR[Label_MultiWall])</onclick>
<onclick>SetProperty(Context.3.BuiltIn,Skin.ToggleSetting(MultiWall_simple)||Dialog.Close)</onclick>
<onclick>RunScript(script.embuary.helper,action=createcontext)</onclick>

https://github.com/sualfred/script.embua...n-txt-file
xml:
RunScript(script.embuary.helper,action=txtfile,path=special://skin/extras/credits.txt,header=$LOCALIZE[470],prop=MyCredits)

As I said, I would only be using it for Omega, so there's no rush at all, and of course, don't feel obligated. Thanks anyway for all the work you're doing to improve Kodi!
If I have helped you or increased your knowledge, please click the 'thumbs up' button to give thanks :)
Reply
#50
@manfeed - Thanks. Yeah I should be able to implement most of these

(2023-09-26, 20:52)manfeed Wrote: https://github.com/sualfred/script.embua...ntext-menu

Context Menu is already possible:
https://github.com/jurialmunkey/script.s...ui-dialogs

v1.1.26 now allows changing the list separator (to make it possible to use `/` inside the list choices).
It will also be possible to chain multiple executebuiltins using double-pipe "||"

xml:

<onclick>RunScript(script.skinvariables,run_dialog=contextmenu,list=$LOCALIZE[457] / $LOCALIZE[33063]||$LOCALIZE[208]||$VAR[Label_MultiWall],separator=||,"executebuiltin_0=SetProperty(HideWall,True,home)||ClearProperty(AnimWall2,home)||SetProperty(MediaMenu,True,home)||SetFocus(9050)","executebuiltin_1=SetFocus(586)||Action(Play)","executebuiltin_2=Skin.ToggleSetting(MultiWall_simple)||Dialog.Close")</onclick>


(2023-09-26, 20:52)manfeed Wrote: https://github.com/sualfred/script.embua...go-to-path
xml:
RunScript(script.embuary.helper,action=goto,path='"plugin://plugin.video.youtube/kodion/search/query/?q=$INFO[Container(10051).ListItem.Title]&search_type=videos"',target=videos)

I don't understand the purpose of this script method. This can already be done natively using skin code.
I get that it is slightly more convenient in terms of code but doing it natively will be much more reliable and faster:

xml:

<onclick>Dialog.Close(all,force)</onclick>
<onclick condition="!Window.IsVisible(MyVideoNav.xml)">ActivateWindow(videos,plugin://plugin.video.youtube/kodion/search/query/?q=$INFO[Container(10051).ListItem.Title]&search_type=videos,return)</onclick>
<onclick condition="Window.IsVisible(MyVideoNav.xml)">Container.Update(plugin://plugin.video.youtube/kodion/search/query/?q=$INFO[Container(10051).ListItem.Title]&search_type=videos)</onclick>

(2023-09-26, 20:52)manfeed Wrote: https://github.com/sualfred/script.embua...#play-item
xml:
RunScript(script.embuary.helper,action=playitem,dbid=$INFO[Container(10051).ListItem.DBID])

I also don't understand the purpose of retrieving the item via JSON RPC by DBID to play it. If you've already got the DBID then you're going to have the filepath, so why not just play the item directly using PlayMedia? That'll be way faster than a JSON RPC lookup.

xml:

<onclick>PlayMedia($ESCINFO[Container(10051).ListItem.FileNameAndPath])</onclick>


All the rest happy to implement and should be fairly easy to do. I just don't understand the purpose of those two above -- but also happy to implement them if there's a real need for them other than the convenience of not typing a couple of extra lines of skin code.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#51
(2023-09-26, 20:52)manfeed Wrote: https://github.com/sualfred/script.embua...ile-exists
xml:
RunScript(script.embuary.helper,action=lookforfile,file='$ESCINFO[ListItem.Path,,theme.mp3]',prop=theme_ready)

Added in v1.1.26
https://github.com/jurialmunkey/script.s...-container

(2023-09-26, 20:52)manfeed Wrote: https://github.com/sualfred/script.embua...ode-string
xml:
RunScript(script.embuary.helper,action=encode,string='$INFO[ListItem.Album]',prop=EncodedAlbumName)

Added in v1.1.26
https://github.com/jurialmunkey/script.s...-container

(2023-09-26, 20:52)manfeed Wrote: https://github.com/sualfred/script.embua...n-txt-file
xml:
RunScript(script.embuary.helper,action=txtfile,path=special://skin/extras/credits.txt,header=$LOCALIZE[470],prop=MyCredits)

Added in v1.1.26
Any dialog with a message/text field can now load from a text file by specifying the load_file param

xml:

RunScript(script.skinvariables,run_dialog=textviewer,text=special://skin/extras/credits.txt,load_file)
RunScript(script.skinvariables,run_dialog=ok,message=special://skin/extras/credits.txt,load_file)
RunScript(script.skinvariables,run_dialog=yesno,message=special://skin/extras/credits.txt,load_file)
RunScript(script.skinvariables,run_dialog=yesnocustom,message=special://skin/extras/credits.txt,load_file)
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#52
That was fast… thanks! I’ll try the methods you said to save some script calls, I guess your solutions are best.

It’s a pleasure to have the help of someone so knowledgeable as you. Thanks again!
If I have helped you or increased your knowledge, please click the 'thumbs up' button to give thanks :)
Reply
#53
@jurialmunkey could you explain how to use Get List of Container ListItem Infolabels (Container) please?

I tried this in DialogMovieInformation -

<content>plugin://script.skinvariables/?info=get_container_labels&amp;containers=50&amp;infolabel=ListItem.Label</content>

hoping it would grab info from the hidden list id=50 but just got an error.

Thanks.
Reply
#54
@Hitcher - Sorry that's my fault. I messed up the example in the wiki.
For that one it should be just the infolabel part without "ListItem". e.g. infolabel=Label

I also accidentally left in a "numitems" param as required from a test I was doing, so that's likely the error you're getting. It's not actually used for anything but acts as a dummy "reload" value to trick Kodi into refreshing the container by changing the content path if the items in the parent container change e.g. numitems=$INFO[Container(50).NumItems].

You can use any value for "numitems=" as it is discarded and not actually used. I've removed it as required on nexus master, so from next release you will be able to use the more sensibly named "reload=" instead (but numitems will also still be fine -- any param which is unused will simply be discarded).


Try this:
<content>plugin://script.skinvariables/?info=get_container_labels&amp;containers=50&amp;infolabel=Label&amp;numitems=$INFO[Container(50).NumItems]</content>
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#55
Yeah it was numitems error.

Works great now, thanks.

PS Is it possible to get more than one infolabel? And artwork?
Reply
#56
(2023-09-28, 10:42)Hitcher Wrote: PS Is it possible to get more than one infolabel? And artwork?

Multiple infolabels now possible with this commit (will be in next release: 1.1.28)
https://github.com/jurialmunkey/script.s...3b888bac9b

e.g. infolabel=Writer+Director

For artwork, you can do e.g. infolabel=Art(poster) to grab all the posters.
If you want to display it as an image rather than a label, just put the label in the texture <texture>$INFO[ListItem.Label]</texture>

Unless you mean something else?
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#57
That works in adding them to a list as separate items but I was thinking more along the lines of them being grouped in an item.

IE infolabel=Label, infolabel2=Label2, infoicon=icon

xml:
<item>
<label>$INFO[Container(50).ListItemNoWrap(0).Label]</label>
<label2>$INFO[Container(50).ListItemNoWrap(0).Label2]</label2>
<icon>$INFO[Container(50).ListItemNoWrap(0).Icon]</icon>
</item>

Not even sure if that's possible so don't worry about it.

EDIT: I guess what I'm really after is a plugin path of the cast list for a movie/TV show from the library as opposed to using plugin.video.themoviedb.helper.
Reply
#58
(2023-09-29, 19:11)Hitcher Wrote: That works in adding them to a list as separate items but I was thinking more along the lines of them being grouped in an item.

IE infolabel=Label, infolabel2=Label2, infoicon=icon

xml:
<item>
<label>$INFO[Container(50).ListItemNoWrap(0).Label]</label>
<label2>$INFO[Container(50).ListItemNoWrap(0).Label2]</label2>
<icon>$INFO[Container(50).ListItemNoWrap(0).Icon]</icon>
</item>

Not even sure if that's possible so don't worry about it.

EDIT: I guess what I'm really after is a plugin path of the cast list for a movie/TV show from the library as opposed to using plugin.video.themoviedb.helper.

I actually added some similar functionality yesterday along these lines (will be in next release 1.1.28)
https://github.com/jurialmunkey/script.s...12a15afd66

Allows to optionally specify thumb= and label2=

e.g.
infolabel=Label&amp;thumb=Icon&amp;label2=Label2
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#59
Awesome. Thanks for all the support you're giving us.
Reply
#60
@jurialmunkey I've just started to use the viewtype builder but I'm getting this error when running it.

Code:
2023-11-14 11:45:15.173 T:3896 error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'json.decoder.JSONDecodeError'>
Error Contents: Expecting property name enclosed in double quotes: line 11 column 5 (char 226)
Traceback (most recent call last):
File "C:\Kodi_nightly\portable_data\addons\script.skinvariables\resources\lib\script.py", line 64, in run
route_taken = set.intersection(routes_available, params_given).pop()
KeyError: 'pop from an empty set'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Kodi_nightly\portable_data\addons\script.skinvariables\resources\lib\viewtypes.py", line 47, in meta
return self._meta
AttributeError: 'ViewTypes' object has no attribute '_meta'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Kodi_nightly\portable_data\addons\script.skinvariables\script.py", line 9, in <module>
Script(*sys.argv[1:]).run()
File "C:\Kodi_nightly\portable_data\addons\script.skinvariables\resources\lib\script.py", line 66, in run
return self.router()
File "C:\Kodi_nightly\portable_data\addons\script.skinvariables\resources\lib\script.py", line 72, in router
return ViewTypes().update_xml(skinfolder=self.params.get('folder'), **self.params)
File "C:\Kodi_nightly\portable_data\addons\script.skinvariables\resources\lib\viewtypes.py", line 363, in update_xml
if not self.meta:
File "C:\Kodi_nightly\portable_data\addons\script.skinvariables\resources\lib\viewtypes.py", line 49, in meta
self._meta = loads(self.content) or {}
File "C:\Kodi_nightly\system\python\Lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "C:\Kodi_nightly\system\python\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Kodi_nightly\system\python\Lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 11 column 5 (char 226)
-->End of Python script error report<--

This is my skinviewtypes.json -

json:
{
"prefix": "Exp_View",
"viewtypes": {
"50": "31161",
"51": "31130",
"52": "31111",
"53": "31160",
"54": "31112",
"55": "31159",
"56": "31172",
},
"rules": {
"images": {
"rule": "Container.Content(images)",
"viewtypes": ["50", "53", "55"],
"library": "50",
},
"videos": {
"rule": "Container.Content(videos)",
"viewtypes": ["50", "51", "52", "53", "55", "56"],
"library": "50",
},
"movies": {
"rule": "Container.Content(movies)",
"viewtypes": ["53"],
"library": "53",
},
"sets": {
"rule": "Container.Content(sets)",
"viewtypes": ["53"],
"library": "53",
},
"tvshows": {
"rule": "Container.Content(tvshows)",
"viewtypes": ["51", "53"],
"library": "53",
},
"seasons": {
"rule": "Container.Content(seasons)",
"viewtypes": ["51", "53"],
"library": "53",
},
"episodes": {
"rule": "Container.Content(episodes)",
"viewtypes": ["52"],
"library": "52",
},
"genres": {
"rule": "Container.Content(genres)",
"viewtypes": ["50"],
"library": "50",
},
"years": {
"rule": "Container.Content(years)",
"viewtypes": ["50"],
"library": "50",
},
"studios": {
"rule": "Container.Content(studios)",
"viewtypes": ["50"],
"library": "50",
},
"directors": {
"rule": "Container.Content(directors)",
"viewtypes": ["50"],
"library": "50",
},
"countries": {
"rule": "Container.Content(countries)",
"viewtypes": ["50"],
"library": "50",
},
"tags": {
"rule": "Container.Content(tags)",
"viewtypes": ["50"],
"library": "50",
},
"roles": {
"rule": "Container.Content(roles)",
"viewtypes": ["50"],
"library": "50",
},
"actors": {
"rule": "Container.Content(actors)",
"viewtypes": ["50"],
"library": "50",
},
"playlists": {
"rule": "Container.Content(playlists)",
"viewtypes": ["50"],
"library": "50",
},
"games": {
"rule": "Container.Content(games)",
"viewtypes": ["50", "53", "55"],
"library": "50",
},
"musicvideos": {
"rule": "Container.Content(musicvideos)",
"viewtypes": ["50", "53", "55"],
"library": "50",
},
"artists": {
"rule": "Container.Content(artists)",
"viewtypes": ["50"],
"library": "50",
},
"albums": {
"rule": "Container.Content(albums)",
"viewtypes": ["50"],
"library": "50",
},
"songs": {
"rule": "Container.Content(songs)",
"viewtypes": ["54", "50"],
"library": "54",
},
"files": {
"rule": "Container.Content(files)",
"viewtypes": ["50"],
"library": "50",
},
"sources": {
"rule": "Container.Content(sources)",
"viewtypes": ["50"],
"library": "50",
},
"addons": {
"rule": "Container.Content(addons)",
"viewtypes": ["50"],
"library": "50",
}

}
}

Thanks.
Reply

Logout Mark Read Team Forum Stats Members Help
script.skinvariables - Construct skin variables and perform other skin functions0