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

Cannot read property 'guid' of undefined #3

Closed
PTRFRLL opened this issue Dec 9, 2020 · 2 comments
Closed

Cannot read property 'guid' of undefined #3

PTRFRLL opened this issue Dec 9, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@PTRFRLL
Copy link
Contributor

PTRFRLL commented Dec 9, 2020

I get this error right away when using the app. The initial cards load but once I run out, no more are populated by the sendNextBatch method

[34mINFO Got a login: {"name":"Peter","roomCode":"L3O5"}[39m
DEBUG New session created. Active session ids are: L3O5
DEBUG New user Peter logged in
DEBUG Peter asked for the next batch of movies
[31mERROR TypeError: Cannot read property 'guid' of undefined
at getRandom (plex.ts:68:38)
at plex.ts:71:22
at async session.ts:157:31
at async Promise.all (index 1)
at async Session.sendNextBatch (session.ts:154:7)
at async Session.handleMessage (session.ts:103:11)[39m
@LukeChannings
Copy link
Owner

This appears to happen if the selected library doesn't have any videos in it. I've added some logging in v1.0.2 to make it easier to see what might cause this.

Let me know how you get on!

@PTRFRLL
Copy link
Contributor Author

PTRFRLL commented Dec 10, 2020

Looks like it occurs in getRandomMovie when there are fewer movies in the library than the MOVIE_BATCH_SIZE. My 4K library only has 19 movies, if I set MOVIE_BATCH_SIZE to 10, the initial load works but when it goes to fetch 10 more, there are not enough unique movies left, so it gets stuck in this loop:

if (drawnGuids.has(movie.guid)) {
      return getRandom(movies)

This is sort of mitigated by the new LIBRARY_FILTER as now I can select my much larger library but others may run into this if they "run out" of movies to match

@LukeChannings LukeChannings added the bug Something isn't working label Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants