Release script.skinvariables - Construct skin variables and perform other skin functions
#61
@Hitcher - Your JSON is invalid because of trailing commas. JSON splits at commas, so it always expects a new item to start after a comma. It trips me up all the time.

Basically it should be "a,b,c" not "a,b,c,"

e.g. the commas at the end of all your "library" lines should be removed because the next character is a closing curly brace. Same goes for the last line in your viewtype labels.

e.g. this is invalid
json:

"sources": {
"rule": "Container.Content(sources)",
"viewtypes": ["50"],
"library": "50",
},
"addons": {
"rule": "Container.Content(addons)",
"viewtypes": ["50"],
"library": "50",
}

To be valid JSON that would be:

json:

"sources": {
"rule": "Container.Content(sources)",
"viewtypes": ["50"],
"library": "50"
},
"addons": {
"rule": "Container.Content(addons)",
"viewtypes": ["50"],
"library": "50"
}



If you're using SublimeText3, I'd recommend installing SublimeLinter with the SublimeLinter-json package using the strict value set to True and it will highlight these trailing comma errors for you.
https://packagecontrol.io/packages/SublimeLinter-json
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#62
Thanks. Weird thing is I checked it was valid using an online checker and it said it was fine. Huh
Reply
#63
EDIT: Figured it out.

Almost there but 2 view types are visible at all for some reason.

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", "55"],
"library": "52",
"plugins": "55"
},
"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"
},
"none": {
"rule": "Container.Content()",
"viewtypes": ["50"],
"library": "50"
}

}
}

xml:
<?xml version="1.0" encoding="UTF-8"?>
<includes>

<expression name="Exp_View_50">[[Container.Content(images) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(videos) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(genres) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(years) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(studios) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(directors) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(countries) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(tags) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(roles) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(actors) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(playlists) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(games) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(musicvideos) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(artists) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(albums) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(files) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(sources) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(addons) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content() + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]]]</expression>
<expression name="Exp_View_50_Include">True</expression>
<expression name="Exp_View_51">[False]</expression>
<expression name="Exp_View_51_Include">False</expression>
<expression name="Exp_View_52">[[Container.Content(episodes) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]]]</expression>
<expression name="Exp_View_52_Include">True</expression>
<expression name="Exp_View_53">[[Container.Content(movies) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(sets) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(tvshows) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(seasons) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]]]</expression>
<expression name="Exp_View_53_Include">True</expression>
<expression name="Exp_View_54">[[Container.Content(songs) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]]]</expression>
<expression name="Exp_View_54_Include">True</expression>
<expression name="Exp_View_55">[False]</expression>
<expression name="Exp_View_55_Include">False</expression>
<expression name="Exp_View_56">[False]</expression>
<expression name="Exp_View_56_Include">False</expression>
</includes>

55 and 56 are empty. Confused
Reply
#64
(2023-11-14, 16:20)Hitcher Wrote: EDIT: Figured it out.

Almost there but 2 view types are visible at all for some reason.

xml:
<?xml version="1.0" encoding="UTF-8"?>
<includes>

<expression name="Exp_View_50">[[Container.Content(images) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(videos) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(genres) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(years) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(studios) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(directors) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(countries) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(tags) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(roles) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(actors) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(playlists) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(games) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(musicvideos) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(artists) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(albums) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(files) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(sources) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(addons) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content() + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]]]</expression>
<expression name="Exp_View_50_Include">True</expression>
<expression name="Exp_View_51">[False]</expression>
<expression name="Exp_View_51_Include">False</expression>
<expression name="Exp_View_52">[[Container.Content(episodes) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]]]</expression>
<expression name="Exp_View_52_Include">True</expression>
<expression name="Exp_View_53">[[Container.Content(movies) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(sets) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(tvshows) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]] | [Container.Content(seasons) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]]]</expression>
<expression name="Exp_View_53_Include">True</expression>
<expression name="Exp_View_54">[[Container.Content(songs) + [[String.IsEmpty(Container.PluginName)] | [!String.IsEmpty(Container.PluginName)]]]]</expression>
<expression name="Exp_View_54_Include">True</expression>
<expression name="Exp_View_55">[False]</expression>
<expression name="Exp_View_55_Include">False</expression>
<expression name="Exp_View_56">[False]</expression>
<expression name="Exp_View_56_Include">False</expression>
</includes>

55 and 56 are empty. Confused

That's correct and working as intended.

In your default configuration, neither view 55 or 56 are being used so their visibility is set to false (additionally 51 is not currently being used). When you run the script to change views and select one of those views for one of the rules, the visibility conditions will update so that they become visible in those contexts (and the previously used views will be set to false for those rules).

Additionally the Exp_View_55_Include and Exp_View_56_Include expressions are also set to false so that you can prevent those viewtypes code from being included until they are actually required by the user.

The whole purpose of the visibility conditions is that they force only one specific viewtype to be visible per rule (and per plugin/library) so that Kodi cannot arbitrarily change the viewtype. If the only visible viewtype is the one the user has chosen then it is impossible for Kodi to select a different one.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#65
Thanks for the explanation, it's helped me understand things a lot better now. And I also know what the _Include parts are for, don't know how I didn't realise they're used as conditions for the view includes.
Reply
#66
Got it all working now and I wish I'd looked into it earlier as it's really helpful. Just want to say thanks for all your addons and the help you give us.
Reply
#67
Since my skin now has script.skinvariables as a required addon, I would need that at least version 1.1.46 would be available through the Kodi official repo before submitting an Omega version of my skin to the official repo, however I see that only 0.2.5 version is currently available. Do you know when an updated version of this wonderful script will be available? Many thanks for your great work!
If I have helped you or increased your knowledge, please click the 'thumbs up' button to give thanks :)
Reply
#68
(2023-12-10, 13:32)manfeed Wrote: Since my skin now has script.skinvariables as a required addon, I would need that at least version 1.1.46 would be available through the Kodi official repo before submitting an Omega version of my skin to the official repo, however I see that only 0.2.5 version is currently available. Do you know when an updated version of this wonderful script will be available? Many thanks for your great work!

I'll try to submit a PR for it soon.

As to how long it will take for review once submitted, I can't say. It really depends on when someone in the team has the time to review it.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#69
(2023-12-11, 02:03)jurialmunkey Wrote: I'll try to submit a PR for it soon.

As to how long it will take for review once submitted, I can't say. It really depends on when someone in the team has the time to review it.

Not trying to push you in any way, but I would be very grateful if you could do that, please. Thanks!
If I have helped you or increased your knowledge, please click the 'thumbs up' button to give thanks :)
Reply

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