Container.SetSortMethod

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Jeroen Offline
Skilled Skinner
Posts: 1,885
Joined: Feb 2008
Reputation: 4
Location: The Netherlands
Post: #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 Frown
find quote
Hitcher Offline
Skilled Skinner
Posts: 9,976
Joined: Aug 2007
Reputation: 67
Location: Eastleigh, UK
Post: #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

[Image: sig_zps3af3b48e.jpg]
find quote
pieh Offline
Team-XBMC Member
Posts: 672
Joined: Aug 2010
Reputation: 13
Location: Poland
Post: #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
find quote
Jeroen Offline
Skilled Skinner
Posts: 1,885
Joined: Feb 2008
Reputation: 4
Location: The Netherlands
Post: #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
find quote