Sorting addon-created listitem 'episode's by date
#1
Basically I'm using an addon that displays a bunch of published videos (ie similar to youtube etc) as listitems with mediatype 'episode', and I'm using Yatse to navigate to the addon's virtual-'folder' containing these episodes.

Yatse  I have configured to sort lists by date - specifically it sends a Files.GetDirectory with {"method":"date","order":"descending"}
Kodi's API is even returning "lastmodified": "" so even if yatse/any other remote program wanted to manually sort the list, it's impossible.

If you go to a "real" tv series in the database, this works perfectly (as newer episodes end up at the top etc) and the API returns a lastmodified date that seems to match the episode date.

If you go to this video addon (and any others, tested with vimeo for example) it seems to be impossible for a ListItem to actually provide a date to be sorted by, so it ends up alphabetical descending.
I've tried all the following within the addon:

python:
'date': str(published.format('YYYY-MM-DD')),
'dateadded': str(published.format('YYYY-MM-DD HH:mmConfuseds')),
'premiered': str(published.format('YYYY-MM-DD')),
'aired': str(published.format('YYYY-MM-DD')),

Interestingly the actual kodi interface I can sort by Date Added, but the API refuses to sort by 'date'

What, if anything, can I set in the ListItem to get kodi to sort it by 'date'?
Reply
#2
as far as i can tell the sort isnt being used on Files.GetDirectory - https://github.com/xbmc/xbmc/blob/master...ns.cpp#L69

potential feature request?
Reply
#3
The GetDirectory API documentation definitely has a sort parameter that does work when sorting by 'date' for actual folders/files when browsing things like SMB paths. I would guess some other part of the API interface pulls that param and applies it to the result before sending
Reply
#4
alright then wait for the developer to come explain the code to you
Reply
#5
(2023-08-04, 10:16)mrsix Wrote: Interestingly the actual kodi interface I can sort by Date Added, but the API refuses to sort by 'date'

What, if anything, can I set in the ListItem to get kodi to sort it by 'date'?

If I am looking at the list.sort method properly (hit expand option) the only date sort option which is valid is "year".  Have you tried it ?  This won't get you what you want but will ensure the documentation is correct.  Worst case is a post fetching sort approach.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#6
'date' is one of the valid options on that list (3rd) - the problem is I don't seem to be able to make a ListItem that contains a date that it can actually sort by.
Reply
#7
(2023-08-05, 22:24)mrsix Wrote: 'date' is one of the valid options on that list (3rd) - the problem is I don't seem to be able to make a ListItem that contains a date that it can actually sort by.

Yes, but date is not a listitem value other than a file date.    Year is, hence my question.  I thought you were looking for when the underlying listitem video was published not when the file was written.  What is populating the lisitem data and are you sure some of the source has the various date fields (i.e. premiered, aired etc..) ?  I didn't include dataadded since I don't think that is what you are looking for. 


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#8
It looks like ListItem now has a setDateTime method as of 20.0 which does seem to do exactly what I was hoping for - once I've set that the API call does correctly sort by 'date'
Reply
#9
(2023-08-05, 23:38)mrsix Wrote: It looks like ListItem now has a setDateTime method as of 20.0 which does seem to do exactly what I was hoping for - once I've set that the API call does correctly sort by 'date'


You might want to look at this thread I started on v20 changes. This is discussed.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply

Logout Mark Read Team Forum Stats Members Help
Sorting addon-created listitem 'episode's by date0