Sorting plugin items with arbitrary order
#1
Question 
I would like to display items in a plugin directory in an arbitrary order that has nothing to do with their name, etc. Is this possible?

The two possibilities I can forsee are to sort them according to a playlist or give them an arbitrary date and sort according to that but with the documentation available I can't figure out how to do it.

Perhaps a new sort method that sorts according to order added would be most useful.
Reply
#2
There are a number of ways to sort an item (http://xbmc.sourceforge.net/python-docs/xbmcplugin.html). You can add any arbitrary information using setInfo .

What exactly are you trying to do?
Always read the XBMC online-manual, FAQ and search and search the forum before posting.
For troubleshooting and bug reporting please read how to submit a proper bug report.

If you're interested in writing addons for xbmc, read docs and how-to for plugins and scripts ||| http://code.google.com/p/xbmc-addons/
Reply
#3
I have the script I mentioned in http://forum.xbmc.org/showthread.php?tid=39055 and I'm scraping it's output with a simple plugin. What I want is a listing like this:

October 27, 2008
New_file4.avi(HOST1/TV/New_file4.avi)
New_file5.avi(HOST1/TV/New_file5.avi)
New_file6.avi(HOST2/Movies/New_file6.avi)
October 26, 2008
New_file1.avi(HOST2/Movies/New_file1.avi)
New_file2.avi(HOST2/TV/New_file2.avi)
New_file3.avi(HOST1/TV/New_file3.avi)

But I can't get it to sort correctly.
Reply
#4
you can try unsorted or none. i haven't ever tried that so idk if it will work like that, but please look at http://xbmc.sourceforge.net/python-docs/xbmcplugin.html and TRY it because 1) thats the only way you'll learn and 2) it would be better to do it like that versus setting some label randomly.

or you can set virtually anything except title and sort by that

ex. genre.

Code:
genre=SomeNumberDefinedEarlier
liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png")
liz.setInfo( type="Video", infoLabels={"Title":name,"Genre":genre} )
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)

#...

xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_GENRE)
Always read the XBMC online-manual, FAQ and search and search the forum before posting.
For troubleshooting and bug reporting please read how to submit a proper bug report.

If you're interested in writing addons for xbmc, read docs and how-to for plugins and scripts ||| http://code.google.com/p/xbmc-addons/
Reply
#5
I should have mentioned that I had already tried the above method with playlist order and date and it didn't work. That's why I posted.

I just checked "unsorted" and "none" and they just use the default sort which is sort by name. Switching my code to use Genre does work, though. Thanks.
Reply

Logout Mark Read Team Forum Stats Members Help
Sorting plugin items with arbitrary order0