Posts: 3,660
Joined: Feb 2008
Reputation:
93
Jeroen
Team-Kodi Member
Posts: 3,660
2010-06-12, 15:41
(This post was last modified: 2010-06-12, 15:44 by Jeroen.)
I'm trying to set a default viewtype based on the contents listed in MyPics.xml
Basically:
container only has folders -> use viewtype A
container has files or files and folders -> use viewtype B
I tried using <visible>Container().HasFiles</visible> and <visible>!Container().HasFiles</visible>, but this doesn't seem to work. Should it though?
Jeroen
Posts: 3,660
Joined: Feb 2008
Reputation:
93
Jeroen
Team-Kodi Member
Posts: 3,660
I should have mentioned that I tried that too. As well as filling in the container ID's.
Right now, I have just one source in mypictures. So, even though the root just has 1 folder and the add source link, it still displays the view I want to only display if files are being listed. Weird, because I definitely think I have used this successfully before.
Posts: 26,215
Joined: Oct 2003
Reputation:
187
Container.HasFiles returns true if there is one or more files.
Container.HasFolders returns true if there is one or more folders.
Thus you want !Container.HasFiles on viewtype A and Container.HasFiles on viewtype B. Note that !Container.HasFiles is very inefficient if the folder doesn't actually contain any files, but that's not your concern really.
I assume you've done that and it's still not working? If so, it may be due to the order in which these things are evaluated, and could be related to the bug where we background fetch the folder so viewtypes are shown when they shouldn't be?
EDIT: Also, try it on some folders that actually only contain "real" folders - it may be that the "Add source" link isn't a real folder...
Cheers,
Jonathan
Posts: 3,660
Joined: Feb 2008
Reputation:
93
Jeroen
Team-Kodi Member
Posts: 3,660
Yes, I tried those but it just seems to always pick the viewtype that should be used for the container with files and use it on the container for folders.
So yes, maybe it is a matter of which gets evaluated first.
Also, I use the same method for video files, and it seems to works just fine there.
Posts: 3,660
Joined: Feb 2008
Reputation:
93
Jeroen
Team-Kodi Member
Posts: 3,660
Ok, I'll look into that later.
One thing I'm not sure if I made clear before, this problem only seems to apply to the main pictures node only. I added a folder with no files inside to the sources, and it got assigned the correct listview. An added folder with files inside also gets assigned the correct listview. So the trouble is only at the top level.
Posts: 26,215
Joined: Oct 2003
Reputation:
187
Ah - as I indicated earlier, I wonder if it's the "Add Source" node that's causing it - mind turning them off (somewhere in appearance settings IIRC) and seeing if it still happens?
Cheers,
Jonathan
Posts: 26,215
Joined: Oct 2003
Reputation:
187
Righto - will see if I can remedy that.
Cheers,
Jonathan
Posts: 3,660
Joined: Feb 2008
Reputation:
93
Jeroen
Team-Kodi Member
Posts: 3,660
I have to correct my statement earlier about this happening for pictures only. Seems I was wrong or overlooked something or whatever but the problem occurs for myvideos too. Disabling the add source button does work around it there too though.
Posts: 26,215
Joined: Oct 2003
Reputation:
187
Yup - the add source button is considered a "file". Reason is that that ensures it stays on the bottom of the list regardless of sort method. This makes it tricky to fix unfortunately.