addonbrowser - conditional viewtype layout
#1
I'd like my list view for addonbrowser to have different layouts based on what the container is listing.

Is there a way for me to use a conditional to determine whether the container is listing actual add-ons or add-on categories (so like video add-ons, music add-ons, etc)?
Reply
#2
i suppose this should work:

add-on categories: ListItem.IsFolder

actual addons: !ListItem.IsFolder
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
maybe it also works to

StringCompare(Container.Property(AddonCategory),$LOCALIZE[24011])

PHP Code:
{{"unknown",                           ADDON_UNKNOWN,                 0"" },
   {
"xbmc.metadata.scraper.albums",      ADDON_SCRAPER_ALBUMS,      24016"DefaultAddonAlbumInfo.png" },
   {
"xbmc.metadata.scraper.artists",     ADDON_SCRAPER_ARTISTS,     24017"DefaultAddonArtistInfo.png" },
   {
"xbmc.metadata.scraper.movies",      ADDON_SCRAPER_MOVIES,      24007"DefaultAddonMovieInfo.png" },
   {
"xbmc.metadata.scraper.musicvideos"ADDON_SCRAPER_MUSICVIDEOS24015"DefaultAddonMusicVideoInfo.png" },
   {
"xbmc.metadata.scraper.tvshows",     ADDON_SCRAPER_TVSHOWS,     24014"DefaultAddonTvInfo.png" },
   {
"xbmc.metadata.scraper.library",     ADDON_SCRAPER_LIBRARY,         0"" },
   {
"xbmc.ui.screensaver",               ADDON_SCREENSAVER,         24008"DefaultAddonScreensaver.png" },
   {
"xbmc.player.musicviz",              ADDON_VIZ,                 24010"DefaultAddonVisualization.png" },
   {
"visualization-library",             ADDON_VIZ_LIBRARY,             0"" },
   {
"xbmc.python.pluginsource",          ADDON_PLUGIN,              24005"" },
   {
"xbmc.python.script",                ADDON_SCRIPT,              24009"" },
   {
"xbmc.python.weather",               ADDON_SCRIPT_WEATHER,      24027"DefaultAddonWeather.png" },
   {
"xbmc.python.subtitles",             ADDON_SCRIPT_SUBTITLES,    24012"DefaultAddonSubtitles.png" },
   {
"xbmc.python.lyrics",                ADDON_SCRIPT_LYRICS,       24013"DefaultAddonLyrics.png" },
   {
"xbmc.python.library",               ADDON_SCRIPT_LIBRARY,      24014"" },
   {
"xbmc.python.module",                ADDON_SCRIPT_MODULE,           0"" },
   {
"xbmc.gui.skin",                     ADDON_SKIN,                  166"DefaultAddonSkin.png" },
   {
"xbmc.gui.webinterface",             ADDON_WEB_INTERFACE,         199"DefaultAddonWebSkin.png" },
   {
"xbmc.addon.repository",             ADDON_REPOSITORY,          24011"DefaultAddonRepository.png" },
   {
"pvrclient",                         ADDON_PVRDLL,                  0"" },
   {
"xbmc.addon.video",                  ADDON_VIDEO,                1037"DefaultAddonVideo.png" },
   {
"xbmc.addon.audio",                  ADDON_AUDIO,                1038"DefaultAddonMusic.png" },
   {
"xbmc.addon.image",                  ADDON_IMAGE,                1039"DefaultAddonPicture.png" },
   {
"xbmc.addon.executable",             ADDON_EXECUTABLE,           1043"DefaultAddonProgram.png" },
   {
"xbmc.service",                      ADDON_SERVICE,             24018"DefaultAddonService.png" }}; 
For my bad English, sorry. I am French Canadian.
Admin @ Passion-XBMC.org
Reply
#4
I think we really need to provide better default values so that you don't have to do too much hackery in skins.

Container.Content() seems the most suitable to extend. Make a list of exactly what you need and I'll see what I can do. I think there may be a ticket about this already on trac - not sure.

OT: I've been thinking about changing things so that instead of skinning 51294129 windows which basically provide the same thing (list of some content) you instead skin a single window (or a few windows) and instead provide 51294129 view layouts. Not sure if this will reduce code duplication and/or make it easier to skin or not. Thoughts?

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#5
Shouldn't these skin specific based themes be shipped with the actual addon and not the skin? That's what used to happen wasn't it?
Reply
#6
ronie Wrote:i suppose this should work:

add-on categories: ListItem.IsFolder

actual addons: !ListItem.IsFolder
Thanks Ronie, I was thinking way too difficult. Container.HasFiles and Container.HasFolders should indeed do the trick.

FrostBox Wrote:maybe it also works to
...
That's interesting, I can see some other uses for your method, thanks Smile

jmarshall Wrote:I think we really need to provide better default values so that you don't have to do too much hackery in skins.

Container.Content() seems the most suitable to extend. Make a list of exactly what you need and I'll see what I can do. I think there may be a ticket about this already on trac - not sure.
The things I want desperately in this regard are ways for more flexibility in how I can present add-on content. From my experience trying to somehow integrate add-on content using the same containers and layouts as I use for local content, it's just a real pita and it's never going to work as well as I would like unless add-ons get their own content type or add-ons themselves get a strict set of guidelines regarding their formatting.

We've discussed this previously but that was pre-Dharma. I'll see if I can dig up that thread.

Quote:OT: I've been thinking about changing things so that instead of skinning 51294129 windows which basically provide the same thing (list of some content) you instead skin a single window (or a few windows) and instead provide 51294129 view layouts. Not sure if this will reduce code duplication and/or make it easier to skin or not. Thoughts?
I already try to do this as much as possible within the current system. But more possibilities for this would be welcomed as long as the same amount of flexibility is possible. I see benefits for this in dialog windows for instance.

I'll try to write up a more detailed list of what I personally would like to see.
Reply
#7
Jeroen Wrote:That's interesting, I can see some other uses for your method, thanks Smile

Sure, but i not tested Smile

PHP Code:
<control type="list" id="550">
    <
description>Show container if category is Repo</description>
    <
visible>StringCompare(Container.Property(AddonCategory),$LOCALIZE[24011])</visible>
    ...
</
control>

<
control type="panel" id="550">
    <
description>Show container if category is Add-on Video</description>
    <
visible>StringCompare(Container.Property(AddonCategory),$LOCALIZE[1037])</visible>
    ...
</
control>

<
control type="wraplist" id="550">
    <
description>Show container if category is Skins</description>
    <
visible>StringCompare(Container.Property(AddonCategory),$LOCALIZE[166])</visible>
    ...
</
control>

<
control type="fixedlist" id="550">
    <
description>Show container if category is Infos Videos</description>
    <
visible>StringCompare(Container.Property(AddonCategory),$LOCALIZE[24007])</visible>
    ...
</
control

Frost
For my bad English, sorry. I am French Canadian.
Admin @ Passion-XBMC.org
Reply
#8
Thanks Frost Smile I meant your post gave me some ideas. I didn't mean it as a request for you to come up with them Wink But thanks nonetheless Smile


So, on a related note, I can use this condition for example:

stringcompare(container.folderpath,plugin://plugin.video.apple.movie.trailers.lite/)

to show/hide/do whatever when the AMT add-on is active. What I would like to do is something like:

substring(container.folderpath,plugin://plugin.video, )

so that I can use a condition which works for any video add-on. However that doesn't seem to work. Or am I doing something wrong?
Reply
#9
You'd need to do substring to get the substring then stringcompare to compare I think?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#10
SubString(Container.FolderPath,plugin.video) works for me.
Reply

Logout Mark Read Team Forum Stats Members Help
addonbrowser - conditional viewtype layout0