Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch-up videos aired on the same day are not sorted correctly #302

Closed
1 of 7 tasks
thombet opened this issue May 20, 2020 · 5 comments
Closed
1 of 7 tasks

Catch-up videos aired on the same day are not sorted correctly #302

thombet opened this issue May 20, 2020 · 5 comments

Comments

@thombet
Copy link

thombet commented May 20, 2020

Describe the bug

When several episodes of the same show were aired on the same day, the catch-up TV episodes are sorted in the wrong order. This use case is pretty uncommon so I don't know if it occurs for several channels but at least I encountered the bug on France 2.

To Reproduce

Steps to reproduce the behavior:
Go in Replay TV -> France -> France 2 -> Jeux & Divertissements -> N'oubliez pas les paroles -> Replay. For each day there are 2 episodes.

Expected behavior

When sorting by date, the order follows the original aired date and time.

Actual behavior

When sorting by date, the first episode listed is always the one that was aired last.

Your environment

  • Android

  • iOS

  • Linux

  • OSX

  • Raspberry-Pi

  • Windows

  • Other

  • Operating system version/name: OSMC

  • Kodi version: Kodi Leia v18.3

  • Catch-up TV & More version: 0.2.20

  • Installation method: Catch-up TV & More repo

Additional context

I wanted to submit a pull request to fix the issue but I was not able to find a solution...
Here is what I have found:

I think the issue comes from this line: the date saved in item.info.date contains only the date and the time is stripped.
Actually it was probably done like this because it seems Kodi does not support a date which includes time as per the documentation.
I think item.info.date is provided by CodeQuick and since I am not familiar with this library I can't tell if it offers a way to deal with this issue.

Maybe a solution then would be to retrieve the list of videos with the sort criteria begin_date:asc instead of begin_date:desc to ensure the video that was aired first is also processed first. I was not able to make it work though (I don't know if it is because "asc" is a wrong value or because the sorting simply does not work) so I cannot tell if it is bad idea :)

And one improvement idea: maybe it would be better to use video['content_has_medias'][0]['media']['begin_date'] for the date rather than video['first_publication_date'] to ensure the date used is the actual aired date (in case the video is not published the same day as it was aired for instance).

@sy6sy2
Copy link
Member

sy6sy2 commented May 31, 2020

Thank you very munch for this complete bug report!
i will try to reproduce this issue shortly and will try your idea to fix the bug.

@sy6sy2
Copy link
Member

sy6sy2 commented Jun 4, 2020

Commit 49836de should fix your issue.

This commit will be available in 0.2.22~beta04, can you try this modification to confirm or not that this is what you want?

Thank you 😉

@thombet
Copy link
Author

thombet commented Jun 6, 2020

I confirm it works, thanks!

I don't understand how it works though :) You use video['content_has_medias'][0]['media']['begin_date'] if it exists but only the year, the month and the date are extacted which means 2 items will have the same value. How are they eventually sorted in the right order? Is it thanks to the Kodi sort method xbmcplugin.SORT_METHOD_UNSORTED?

@sy6sy2
Copy link
Member

sy6sy2 commented Jun 6, 2020

Yes it works thanks to the Unsorted method.
With this one, Kodi sorts vidéo in the same order of the JSON from France TV API. This is why the order is correct.

Unfortunately, we can’t specify time for video date. Only the day 😕

@thombet
Copy link
Author

thombet commented Jun 7, 2020

Ok now I understand.
Thank you for the information and thank you again for fixing it 😉

@thombet thombet closed this as completed Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants