pictures: Container().HasFiles
#1
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
Reply
#2
Do it like this
Code:
<visible>Container.HasFiles</visible>
Code:
<visible>!Container.HasFiles</visible>

Only use the () if you're putting the container id in it
Reply
#3
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.
Reply
#4
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
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
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.
Reply
#6
Hmm, so it only doesn't work in MyPics? Interesting. A proof of concept (eg a mod to confluence) that I can use to test would be helpful Smile

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
#7
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.
Reply
#8
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
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
#9
Bingo! Laugh

I totally forgot you can turn that off. Yeah, that definitely is the cause, works perfect now Smile
Reply
#10
Righto - will see if I can remedy that.

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
#11
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.
Reply
#12
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.
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
#13
If you really want a condition that is only true when in the root "shares" sections of windows try
PHP Code:
<visible>IsEmpty(Container.FolderPath)</visible
Reply

Logout Mark Read Team Forum Stats Members Help
pictures: Container().HasFiles0