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

Shenanigans with the watched tab #2871

Open
El-Virus opened this issue Feb 10, 2024 · 12 comments
Open

Shenanigans with the watched tab #2871

El-Virus opened this issue Feb 10, 2024 · 12 comments
Labels

Comments

@El-Virus
Copy link
Contributor

El-Virus commented Feb 10, 2024

Operating System Version:
Windows 10 22H2

Popcorn Time Version:
0.5.0

Download date:
2024/02/10

Download URL:
Github Releases

Description

Using the watched tab only displays a few of the watched items.
Then returning to the Movies tab displays "Remote API failed to respond" even though when opening the app it worked just fine. (Console outputs the error shown in the screenshot)
The other tabs work as expected.
(Note that in my case I've watched hundreds of movies, but just a few series, so that might be related)

Screenshot(s) of issue or error(s) logs of developer console (Windows/Linux: F12, MacOS: ⌘ + 0 ... then 'console' tab) image

@kiriles90 kiriles90 added the bug label Feb 10, 2024
@kiriles90
Copy link
Collaborator

kiriles90 commented Feb 10, 2024

@El-Virus You are right, its related to having too many items and how this tab, unlike the Favorites one doesn't use caching. Marking this as a bug and for now anyone having an issue can reset their watched database or just disable the whole tab altogether (both of these can be found in the Settings page)

@kiriles90
Copy link
Collaborator

kiriles90 commented Feb 10, 2024

@El-Virus lol went to find the original PR to message the author for any ideas and just realized.. you are him 😄
So.. any ideas? We can make it cache, but might make the cache huge, or some other way I'm not aware of to resolve the error. In my understanding the issue comes from making too many simultaneous API requests and some of them fail. (at least that's what I remember from when @dutchy1001 found this.. not sure why we haven't opened an issue until now, tbh personally I forgot about it since I don't use this tab that much..)

@dutchy1001
Copy link
Collaborator

After all the issue's I had with the "watched" tab and how slow it was populated with the choosen movies/series I gave up on using it.
I dont really see the use of it as in the main page watched movies are faded anyway (it's a different story for series unfortunatelly).

@El-Virus
Copy link
Contributor Author

El-Virus commented Feb 10, 2024

After all the issue's I had with the "watched" tab and how slow it was populated with the choosen movies/series I gave up on using it. I dont really see the use of it as in the main page watched movies are faded anyway (it's a different story for series unfortunatelly).

Well, using it as a filter for the main movies page is an option. The whole point of the watched tab is that sometimes some of us like to see which movies (or series) we've seen and rewatch them again (or find one in particular we can't remember the name of)

@El-Virus
Copy link
Contributor Author

El-Virus commented Feb 10, 2024

@El-Virus lol went to find the original PR to message the author for any ideas and just realized.. you are him 😄

Indeed 😅

So.. any ideas? We can make it cache, but might make the cache huge, or some other way I'm not aware of to resolve the error.

Yeah, in many cases (such as mine) the cache would be too big, so that would hardly be an option. (Though we could consider adding that as a setting)

In my understanding the issue comes from making too many simultaneous API requests and some of them fail. (at least that's what I remember from when dutchy1001 found this.. not sure why we haven't opened an issue until now, tbh personally I forgot about it since I don't use this tab that much..)

Doesn't the main movies tab (or, yet again, the series tab) query a whole bunch of movies simultaneously? (I haven't looked at that part of the code, and won't be able to do so today).
I'd say that having the watched tab query them the same way the main tab does would be completely fine (A limited quantity of them at a time). Is that possible?
Or does the server decide which movies/series are sent to the client?

@kiriles90
Copy link
Collaborator

kiriles90 commented Feb 10, 2024

But the thing is.. even as a filter it makes individual API request for every movie. And it would get even weirder since I guess it would basically hide the rest of the items, so you'd see like 1-2 items in your list, then have to scroll down for a couple more to appear etc...

The movies/series lists make a single API request per 25-50 items, and get limited info back. Then if you click on something it makes another request specifically for that item only. The issue with 'watched' is.. both of the APIs we use currently have no such 'list' feature where you can drop in 50 random imdb id's all together and get a list back, they only have such calls using their own sorters (year, latest, trending etc..). So your feature relies on making single calls for every item, like the movie/show detail page, to populate its list, which when you do 25-50 at a time.. is too much.. Favorites overcomes this by caching the limited data from the first 'mass'(list) call (for items marked as facorites only) and only doing single calls when you click on something for more, like the movie/series list does.. It would be an easy fix for this also but I'm not really sure how big the cache would get in this scenario..

@El-Virus
Copy link
Contributor Author

Well, then the only two options are storing them in the cache or implementing a list feature in the server (It would still be backwards compatible given that we are just adding a feature).

For the cache option, in my case, I have ~40 movies in my bookmarks, with a cache of 443kb. So, it's about 11kb/movie, let's hypothesize I've watched ~900 movies, and we'll change the average size/movie to 15kb, which would make a cache of 13mb, if in my lifespan I end up watching 10 times that, we'd have a 130mb cache, which, personally, I think is not that huge. (The standard low-cost computer today comes with a 512gb SSD, meaning that the database would take up ~0,0002% of the disk).
So, the cache option is quite acceptable.

Implementing the list feature shouldn't be hard (can't assure that, given that I haven't looked at how the server works at all), but it could also be considered. Its worth would depend on how much strain that would cause to the server. Do you see it as a viable option?

Anyway, the cache option seems fine.

@kiriles90
Copy link
Collaborator

Yeah I think the cache option is the more realistic one since what the APIs do isn't always under our control (e.g yts) and even if it were, not many APIs or search features in general offer a feature like this where you can simultaneously list 50 different items based on 50 different query terms.. I guess since that would put a big strain on their systems..?

@dutchy1001
Copy link
Collaborator

My issue was that after adding 100 movies only 8/9 show up in my list adding every refresh a few more and taking a few other off again.
Unless the cashe option is implemented I don't see it usefull

@El-Virus
Copy link
Contributor Author

El-Virus commented Feb 10, 2024

Well, cache it is then.

I think you can do it faster than I, could you handle the matter?

@kiriles90
Copy link
Collaborator

@El-Virus yep I'll have a look at it (though not today, too much PCT for one day :)

@YI8it
Copy link

YI8it commented Feb 23, 2024

The watched database is infact the only reason I use PCT, and I love it for having this feature! My only gripe with it has been that I have had to deal with managing and finding things in it by text alone in my GUI. I did try some APIs like Cinemagoer, but they where all horribly slow and I only got close to figuring out how to parse the IMDB-ID to the image URL, so I'm just using a text GUI for now. I have just shy of 4400 entries in watched.db so waiting minutes per title as with Cinemagoer isn't really ideal. I have many times thought about cloning this repo and start going throught the code so that I could add the "Watched" tab myself, but the code base is a little bit too huge for a non-dev like me :P But I know that if I just knew (and understood) the code that creates one of the "Movies" or "Series" tabs, I could create my own "Watched" tab in like 20 seconds, by just copying and pasting the code for one of those tabs and changing a single math operation. At least if you load stuff the way I've always imagined that you do. If 'A' is the set of all movies and 'B' is the set of watched movies, my guess is that you do something like this today (for-loop for illustrative purposes):

For movie in 'A', if movie not in 'B': load info.

Instead of set difference, you could just use set intersection for loading "Watched" and you're done:

For movie in 'A', if movie also in 'B': load info.

No need to figure out how to solve anything, because you have already solved it when creating the code for the other tabs. Just copy/paste, change set logic, done! At least if my suspicions are true :) I would really love it if I could view and filter my own database with the app! I would actually not be opposed to having it all stored on my local drive, since that would save me the time of figuring out how to crack the IMDB-ID parsing but I at least thought I'd tell you that there probably exist a few second-solution to this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

No branches or pull requests

4 participants