smirgol / plugin.video.crunchyroll

Watch videos from the anime platform Crunchyroll.com on Kodi
GNU Affero General Public License v3.0
45 stars 11 forks source link

A fragment of the OG add-on I call "To the Top" #46

Open Abbaddon911 opened 4 months ago

Abbaddon911 commented 4 months ago

Sorry for the weird title, but the issue is really hard to put into a single, short sentence for a non-native English speaker.

I reported this on the OG add-on, but that already was at a time that development stalled.

So, the issue:

Usually when you play an episode or movie in any other add-on or from your local library, at the end of it you get back into the menu and have the episode/movie you just watched highlighted. You click down or left (depending on your view, of course) and you're now highlighting the next episode.

In the add-on, it's not like that. For example: I currently watch the "Detective Conan HD Remaster" which is a very long list of currently 182 episodes. Now let's assume I just watched episode 132, so I'm expecting to get back into the menu with the highlight/selection being on episode 132, but in reality I have to navigate back down to episode 133 from the very top of the list, which is, with a TV remote, annoying really fast.

I hope it's understandable what I mean, if not I'll try to describe it better tomorrow.

smirgol commented 4 months ago

I understand, but I'm not sure yet if I can come up with a good solution. I'll see what I can do about it.

Usually I add the things to my watchlist, where it will always display the most recent episode, so you don't have to pick the next episode by yourself.

smirgol commented 4 months ago

I've spent some time on this today trying to solve this. Unfortunately I cannot find a satisfying way to implement this. Kodi does, for whatever reason, not provide a way to select a specific list item.

The only way to do this half-assed is to simulate key presses to move up and down in the lists. This interferes with Kodi somewhat remembering where you left the list, so I'd need to simulate like 100 key-up presses to make sure I'm at the start of the list and then X key-down presses to move down to the list item I want to be selected. That's not a solution I'm cool with, I'm afraid.

My only recommendation for you is to add stuff to the watchlist and watch the episodes from there. As said, it will always show you the most recent episode in your watchlist.

Edit: If you have an example addon for me that does what you said, let me know and I can have a look at how they are doing it.

Abbaddon911 commented 4 months ago

That's the thing, EVERY other add-on does it fine. YouTube, Netflix, PrimeVideo, ARD/ZDF Mediatheke and so on, the Crunchyroll add-on was and is the only one that goes back to the top of the list after an episode, that's why I thought it might be an easy fix, but I guess I've been wrong.

One thing the crunchy roll add-on does is, when I highlight episode 112 for example but exit out to watch something on YouTube or Prime and get back into the Crunchyroll add-on it memorized the "way" to where I left, so I only need to spam the "OK" button on my remote a few times to start episode 112. (Another reason I thought it might be just a simple call to KODI to read the "last state before playback" to go back to the highlighted episode after playback, like chrome opening the last used tabs after restart)

But if it's too complicated to implement/fix, then I'll have to keep living with it. Yes, I could go the watch list route you mentioned, but I don't like it. I prefer having the whole series in a "folder" which lists the episodes over a "folder" that shows the episode next to watch of several series, which often prefers Dubs of languages I don't speak rather than Subs of the language I actually speak.

smirgol commented 4 months ago

I'm not saying that it is completely impossible, it's just that I don't know a way to do it. I'm by no means an kodi expert, just a random guy who put some effort into making this addon work again, starting from scratch in terms of knowledge with kodi addon programming and even python. And the documentation of kodi is very suboptimal, to put it nicely. :)

The thing you mention with that it stays at episode 112 is such a thing - kodi does that on it's own and I have no idea why and how it does that and how I could manipulate that.

What I'm doing is to create a list of e.g. episodes and then would like to tell kodi "listen, I need you to select the 10th item in that list, so the user can just press a button to watch it". But there is no such thing in the sparse api documentation. Well, there actually is, but this requires to manually create a view for that list using XML and stuff, but the same feature isn't there for the built-in views. Which just doesn't make any sense, but that's the way it is.

That's frustrating to me as it is to you, as I really would like to solve that and it shouldn't be rocket science at all, but with my current knowledge about kodi I just can't find a way to do it properly and within a reasonable time. At some point I might be smarter and can implement it, but as of now, I can't.

Yes, I could go the watch list route you mentioned, but I don't like it. I prefer having the whole series in a "folder" which lists the episodes over a "folder" that shows the episode next to watch of several series, which often prefers Dubs of languages I don't speak rather than Subs of the language I actually speak.

That is a crunchyroll issue which is related to how they handle the different language versions of an anime and it's really annoying, but it's not too hard to work around it: I usually add new series to my watchlist using the crunchyroll website. Now, when I'm in my watchlist (in the addon) and start the first episode, it likely will start a dubbed version (heck, it once even started a Hindi version). Then I stop it, go back to the watchlist and open the context-menu on the series and select "go to series". Then I chose the correct version I want to watch, start watching it and from thereon it will always show me that version in my watchlist. Just a suggestion. I tried to improve how the language is selected, but it's really a mess with crunchyroll. :)

Yavos commented 4 months ago

I assume this problem has something to do with reloading the view (or its content) after an episode has been watched. I'm not sure about it but I guess there's a call to the API to reload everything after an episode finished. In my queue I get why that is useful but maybe in a season list this should only happen once at opening it? This might not properly update the watched status, though.

smirgol commented 4 months ago

That's how it works - to my knowledge. You can imagine it like a web browser, but without caching or sessions. Each time you click something, Kodi is calling the addon with an URL that tells the addon what to show. That might be going to another view or start a video or whatever.

Within the addon I then create that view from scratch and serve it to Kodi. Once I hand over the view to Kodi, the addon is terminated by Kodi, so there is no cache of the data I have fetched or the views I have created. Kodi in itself might do some caching on its own, but I don't know anything about what it does and when it does that.

So yes, I need to "reload" aka re-create the views when you navigate around (or come back from viewing a video), hence it will not know where you left and you start at the beginning of the list - if Kodi is not doing some voodoo in the background, that is.

The only thing that I actually do cache on purpose is the session data for crunchyroll, so I don't need to make a full login on each request but re-use the session token.

Abbaddon911 commented 1 month ago

I just wanted to leave a little update on this one.

I updated to LibreELEC 12.0 which runs Kodi 21. The issue seems to be not present anymore as it seems Kodi itself is now responsible to handle this.

I now have a different issue, but I feel that's more Kodi related that Add-On related, due to the new caching system used in Kodi 21. Need to do more digging before I report a bug anywhere.