specifying default sortmethod per directory in a plugin?
#1
Is there a way to specify which sort method I want to use per directory in a plugin using xbmcplugin.addSortMethod()?

For example, for a music plugin, if I had the structure artist>album>song.mp3 , I would want artist & album to be sorted by title, but the songs to be sorted by track number.

If so, can someone paste or point me to a working example?
Reply
#2
xbmcplugin.addSortMethod() <- yes

the pydocs have all the possible sort methods. link in my signature.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
I looked at the docs... but addSortMethod() just adds the ability to use that sort method, but doesn't force it.

so for example if I have
Code:
def listArtists():
            xbmcplugin.addSortMethod(int(sys.argv[1]), 10)#sort by title
            addDir(blah blah blah isfolder=true)

def listTracks():
            xbmcplugin.addSortMethod(int(sys.argv[1]), 7)#sort by track
            addDir(blah,blah,blah)

assuming listTracks always comes after listArtists, the default sort method would always be title. At the point where listTracks gets called, I can manually change the sort to track, but it doesn't automatically do it.

I hope this clarifies my initial question -- Is there a way to not just add a sort method, but force it?

(I found a suitable work-around for this particular plugin, but I would still like to know for the future.)
Reply

Logout Mark Read Team Forum Stats Members Help
specifying default sortmethod per directory in a plugin?0