Container.SetSort?
#16
I finally have this working. Lost a lot of time last night on a stupid mistake that I fixed right away this morning when I was well rested.

The last annoying problem ended up not being a bug but rather misunderstanding inputs. Once I put in some debug code and determined what the system was expecting, I found it works properly Smile

So... I'll be getting things cleaned up and what not, and building a good chart of what is what, then submitting the patch.
Reply
#17
Bleh!

Well the code is all done, however SF seems to be unavailable right now so I can't submit the patch. Have to wait I guess.
Reply
#18
While I am waiting on the ability to submit this patch, I figured i'd spend some time discussion how to use the function.

The new function is:
Container.SetSortMethod(methodID)

Sets the container's sorting method to the specified method. methodID is an integer value between 0 and 29 indicating what sort method should be applied to the container. There are currently 30 sort methods in XBMC but they are NOT all available at the same time. What sort method's are available will depend on what media is currently in the container. Passing a method that is not available will simply have no result. IE it won't hurt anything.

Skinners can use Container.Content(contentType) in <visible> tags to try and filter only the proper sort methods. It will however be necessary for us to build a decent table of what methods are available for what media. I'm hoping we can get a wiki page to document this, since it is rather in depth.

From my own testing when writing this function I do know that when the media is Video Library, TV Titles, then the available sort methods are IDs 1, 7, & 16. This is "Name", "Episodes", and "Year".

Here is the table that I built to get things started off, but it will have to be documented nicer at some point:

Code:
methodID        method name                                Button Label
0                SORT_METHOD_NONE
1                SORT_METHOD_LABEL                        Name
2                SORT_METHOD_LABEL_IGNORE_THE            Name
3                SORT_METHOD_DATE                        Date
4                SORT_METHOD_SIZE                        Size
5                SORT_METHOD_FILE                        File
6                SORT_METHOD_DRIVE_TYPE                    Type
7                SORT_METHOD_TRACKNUM                    Track, Episodes
8                SORT_METHOD_DURATION                    Time
9                SORT_METHOD_TITLE                        Title
10                SORT_METHOD_TITLE_IGNORE_THE            Title
11                SORT_METHOD_ARTIST                        Artist
12                SORT_METHOD_ARTIST_IGNORE_THE            Artist
13                SORT_METHOD_ALBUM                        Album
14                SORT_METHOD_ALBUM_IGNORE_THE            Album
15                SORT_METHOD_GENRE                        Genre
16                SORT_METHOD_VIDEO_YEAR                    Year
17                SORT_METHOD_VIDEO_RATING                Rating
18                SORT_METHOD_PROGRAM_COUNT                Play Count, Usage
19                SORT_METHOD_PLAYLIST_ORDER                Playlist
20                SORT_METHOD_EPISODE                        Episode
21                SORT_METHOD_VIDEO_TITLE                    Title, Name
22                SORT_METHOD_PRODUCTIONCODE                Prod Code
23                SORT_METHOD_SONG_RATING                    Rating
24                SORT_METHOD_MPAA_RATING                    Rating
25                SORT_METHOD_VIDEO_RUNTIME                Time
26                SORT_METHOD_STUDIO                        Studio
27                SORT_METHOD_STUDIO_IGNORE_THE            Studio
28                SORT_METHOD_UNSORTED                    Default
29                SORT_METHOD_MAX

Note regarding "Ignore The". In skin settings the user has an option to "Ignore The" when sorting. Many of the sort methods are duplicated, one for ignoring "the", and one for not. This adds a layer of complexity to things, but in order to make it easier on the skinning, I wrote the function so that it translates internally. For example, to sort do a SORT_METHOD_LABEL you can specify either 1, or 2 as the methodID. Either ID will work because the function will simply convert it as needed based on the user's setting.

I'll see about getting a wiki page for this so we can have some proper and clean documentation.
Reply
#19
ability to submit the patch?

http://sourceforge.net/tracker/?group_id...tid=581840

edit: oops i should have read your previous post.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#20
Nuka1195 Wrote:ability to submit the patch?

http://sourceforge.net/tracker/?group_id...tid=581840

edit: oops i should have read your previous post.

Yeah seems to be working now. Earlier when I tried though Sourceforge just gave me a message saying it was under maintenance.

Anyway i'm submitting the path now Smile
Reply
#21
Superb! Can't wait to try this out

Nice job agathorn! Big Grin
Reply
#22
To anyone in the higher up :p

Assuming this patch gets accepted, how would I go about getting a wiki page that I can edit to build up the docs for this? It really should have a page of its own with docs that can be linked in as it isn't quite so cut and dry in usage.
Reply
#23
Assuming you have ninja status on forum, you just create a new page by making a link to the page name you want to use.

For ninja status, PM pike with your username etc.

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
#24
jmarshall Wrote:Assuming you have ninja status on forum, you just create a new page by making a link to the page name you want to use.

For ninja status, PM pike with your username etc.

Cheers,
Jonathan

Thanks i'll drop him a PM. I apparently am not a ninja since I can't even edit my own userpage let alone edit other pages Smile
Reply
#25
ninja status, i like the sound of that. if only i could become a ninja in real life by texting some random person Big Grin
Reply
#26
Ok guys the code is now in the latest SVN build of XBMC.

PLEASE yell if you encounter any errors or even any strangeness. Unfortunately there are lots of different cases involved and there is the chance something got missed.

JMarshall: Thanks for cleaning up my code. I noticed the slight changes you made when I merged, and you definitely write cleaner code than I do. So sorry about that! The bit with my using numbers instead of the SORT_METHOD names was just plain stupid of me! I often forget that i'm not the only one reading the code (probably why I long ago decided to stop doing programming work and only code "for myself" lol).

EDIT: Oh an btw gang the patch also adds an Infolabel for you. Off the top of my head I think it was Container.SortMethod -- Will return the current sort method.
Reply
#27
skunkm0nkee Wrote:Superb! Can't wait to try this out

Nice job agathorn! Big Grin

Did you ever get a chance to start working with this? Curious if its all working for you the way you wanted.
Reply
#28
agathorn Wrote:Did you ever get a chance to start working with this? Curious if its all working for you the way you wanted.

Sorry been busy at work and then was on holiday last week but am hoping to get back into it again over the next few days. Based on what I've seen it should fit the bill but I'll let you know once I've checked out more thoroughly.

Thanks! Big Grin
Reply

Logout Mark Read Team Forum Stats Members Help
Container.SetSort?0