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

SageTV is making too many celebrity requests on Schedules Direct #475

Open
enternoescape opened this issue May 23, 2022 · 3 comments
Open

Comments

@enternoescape
Copy link
Contributor

Bob reached out to ask us to stop pulling URL's for every possible head shot of the cast for every show when we update the EPG. The way this should have originally been implemented was to do an API query on demand (I knew this during implementation and was asked to not make API query a part of getting these head shots). I propose we just comment out this code section until it can be implemented the way Schedules Direct requires.

@Narflex
Copy link
Member

Narflex commented May 23, 2022

Can't we just change this so that it only queries for the URLs when it adds a new Person object to the DB? It looks like the current code requests this for every person in the downloaded EPG programs; even if they already exist in the DB.

@enternoescape
Copy link
Contributor Author

That's still going to be a huge number of images. If I recall (I could be wrong) it only checks if the person doesn't already have an image URL in the DB.

@Narflex
Copy link
Member

Narflex commented May 23, 2022

So this looks like the code that's actually causing the URL fetch to occur that has all the images for a given person:

headShotUrls = SDImages.encodeHeadShots(ensureSession().getCelebrityImages(lookupPersonId));

That is looping over addedAliases which looks like a combination of all addedAlises and addedPeople:

addedAliases.add(person);

And those look like they come from every person that appears in a program or series info:

addedPeople.add(person);

and
addedPeople.add(person);

So my thinking is that if we just changed SDUtils.getPerson to return an Object[2] and the first entry is the Person object and the second one is a Boolean indicating if it was added or not, then we can avoid putting Persons into addedAliases/addedPeople if they were not newly added. This will then miss updates for images added later, but that's no big deal IMO (better than removing support outright).

I would think this would satisfy Bob's request since we're only requesting it for newly added things which will be a massive reduction over requesting it for everything each time.

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

No branches or pull requests

2 participants