Container.SetSortMethod
#1
So, I have a button in MyVideoNav.xml. I want that button to show up in one specific viewtype. No problem. But when clicked I want that button to set the sortmethod to a specific type, like year or name.

The wiki states:
Quote:Container.SetSortMethod: Change to the specified sort method.

But how do I actually specify the sortmethod? I though it was by:

Container.SetSortMethod(method)

But that doesn't work. I tried several other things, but none of them do anything.

I've got a feeling it's probably really obvious but I can't figure it out Confused
Reply
#2
Container.SetSortMethod(n) with the number being the sort method you want from the list below.

Code:
SORT_METHOD_NONE=0,
  SORT_METHOD_LABEL,
  SORT_METHOD_LABEL_IGNORE_THE,
  SORT_METHOD_DATE,
  SORT_METHOD_SIZE,
  SORT_METHOD_FILE,
  SORT_METHOD_DRIVE_TYPE,
  SORT_METHOD_TRACKNUM,
  SORT_METHOD_DURATION,
  SORT_METHOD_TITLE,
  SORT_METHOD_TITLE_IGNORE_THE,
  SORT_METHOD_ARTIST,
  SORT_METHOD_ARTIST_IGNORE_THE,
  SORT_METHOD_ALBUM,
  SORT_METHOD_ALBUM_IGNORE_THE,
  SORT_METHOD_GENRE,
  SORT_METHOD_COUNTRY,
  SORT_METHOD_YEAR,
  SORT_METHOD_VIDEO_RATING,
  SORT_METHOD_DATEADDED,
  SORT_METHOD_PROGRAM_COUNT,
  SORT_METHOD_PLAYLIST_ORDER,
  SORT_METHOD_EPISODE,
  SORT_METHOD_VIDEO_TITLE,
  SORT_METHOD_VIDEO_SORT_TITLE,
  SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE,
  SORT_METHOD_PRODUCTIONCODE,
  SORT_METHOD_SONG_RATING,
  SORT_METHOD_MPAA_RATING,
  SORT_METHOD_VIDEO_RUNTIME,
  SORT_METHOD_STUDIO,
  SORT_METHOD_STUDIO_IGNORE_THE,
  SORT_METHOD_FULLPATH,
  SORT_METHOD_LABEL_IGNORE_FOLDERS,
  SORT_METHOD_LASTPLAYED,
  SORT_METHOD_LISTENERS,
  SORT_METHOD_UNSORTED,
  SORT_METHOD_BITRATE,
  SORT_METHOD_MAX

Found in the SortFileItem.h
Reply
#3
Just to get You started: You'll need to take a look here. There You have highlighted list of all available sort methods in XBMC. Now You have to get integer "id" of sort method You want: (SORT_METHOD_NONE=0, SORT_METHOD_LABEL=1, SORT_METHOD_LABEL_IGNORE_THE=2, ..., just add +1 for every next one). And use that id with Container.SetSortMethod(id).

Example:
Container.SetSortMethod(24) will set sorting to titles (in video section) (SORT_METHOD_VIDEO_SORT_TITLE)
Container.SetSortMethod(18) will set sorting to raiting (SORT_METHOD_VIDEO_RATING)

Notes:
Not every sort method is available in each view, so You'll have to experiment a little.
There are some sorts with _IGNORE_THE appended - xbmc automaticly switch to them if user set Ignore articles when sorting (e.g. "the") in settings -> appearance -> file lists.

-edit
damn, Hitcher was first ;P
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply
#4
Thank you both, that's excellent information Smile

Yeah I noticed already that not all methods are available. Is that because this is still being worked on? Because I would really like to sort on genre, but that one doesn't seem to be working.

What I'm out for is basically creating a column based listview where one is able change the sorting from within the view itself by faux selecting the columns (think along the lines of Kaleidescape)

Cheers guys, great help Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Container.SetSortMethod0