2010-09-15, 08:00
I'm trying to add sorting to the YouTube plugin, everything seems to work ok, but I've come into a little problem and i don't know if it's me using the API wrong or a bug.
Basically I want the user to be able to change the sorting of a video list sorting, but i don't want to alter the default sorting that YouTube provides as these are often sorted by something "YouTube specfic". In order to achieve this im currently add the following sort methods to all video lists:
Since the first item set's the default order for the list i have choosen playlist order as I saw this was hard-coded to a running count in FileItem.cpp:
This seems to work fine at first, the video list is produced in the same order as if i had set it to SORT_METHOD_NONE but after cycling through all the sorting options I can't get the list to return to the original order.. Is this by design or am I doing something wrong?
Basically I want the user to be able to change the sorting of a video list sorting, but i don't want to alter the default sorting that YouTube provides as these are often sorted by something "YouTube specfic". In order to achieve this im currently add the following sort methods to all video lists:
Code:
xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_PLAYLIST_ORDER )
xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_LABEL )
xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_VIDEO_RATING )
xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_DATE )
xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_VIDEO_RUNTIME )
Code:
case SORT_METHOD_PROGRAM_COUNT:
case SORT_METHOD_PLAYLIST_ORDER:
// TODO: Playlist order is hacked into program count variable (not nice, but ok until 2.0)
FillSortFields(SSortFileItem::ByProgramCount);
break;
This seems to work fine at first, the video list is produced in the same order as if i had set it to SORT_METHOD_NONE but after cycling through all the sorting options I can't get the list to return to the original order.. Is this by design or am I doing something wrong?