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

Filesize limit #27

Open
yellowbluesky opened this issue Aug 1, 2019 · 4 comments
Open

Filesize limit #27

yellowbluesky opened this issue Aug 1, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@yellowbluesky
Copy link
Owner

On inspection, while most downloaded images are under 1MB, a number of the imagesbeing downloaded are quite large; from 6 MBs up to 17MB.

Should be trivial if file size can be determined from Response body

@yellowbluesky yellowbluesky added the enhancement New feature or request label Aug 1, 2019
@yellowbluesky
Copy link
Owner Author

As far as I can tell, the only way to determine file size without actually downloading the file itself with w GET is to use a HEAD request, and see if the filesize header is included.

In preliminary (but potentially flawed) testing with the above method, HEAD requests do not contain file size data.

I will test further, but it appears that this will not work.

@yellowbluesky
Copy link
Owner Author

yellowbluesky commented May 13, 2020

Turns out I'm just dumb haha

I can call contentLength() on the Response, and that will return to me the size of the Response's body (image) in bytes.

Now I need to figure out how to integrate it into the current artwork filtering and getting flow:

  • Currently the Response is obtained in getArtworkRanking() or getArtworkAuth() after filterRankingArtwork() or filterAuthArtwork() exits. Rejecting artwork must happen within the filtering methods in order to preserve the history of artworks already rejected and to be abale to properly signal for a new offset JSON.

  • That can be easily worked around by getting filterRankingArtwork() or filterAuthArtwork() methods to grab the Response. For this I'll need a rework of method signatures and how exceptions are passed around

@yellowbluesky
Copy link
Owner Author

yellowbluesky commented May 17, 2020

On further inspection

getArtworkRanking() needs the chosen artwork after filtering to grab variables to pass to Muzei (token, attribution).

I could package the relevant data in a struct / class (the response, and relevant artwork details), but I want to avoid doing it this way if possible

@yellowbluesky
Copy link
Owner Author

I can have the loop that normally runs in filterArtworkRanking() be run in getArtworkRanking()

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

No branches or pull requests

1 participant