-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
url cache is not used when offline #4989
Comments
yes, this is supposed to work, please send us your logs |
Thanks for confirming that I wasn't missing something. I found the problem now, and it was at my end. I missed numerous images when reading the .cod xml files to aggregate card names to throw at scryfall, because I assumed main and side would always be in the same order in the xml. It was these missing images that would keep redownloading, the other ones do get read from local storage if they are in So this can be closed. Hope I didn't bother anyone. |
I am still confused with your issue, you don't have to redownload images ever, when a picture is downloaded on the fly it is stored indefinitely or until you delete the cache. |
That is the problem. No images are stored after being downloaded on the fly. They are always redownloaded. This can be tested by loading a deck, then reloading it again after a cockatrice reboot and without an internet connection. Example process:
And so on, for all cards without an image in CUSTOM, until the script bails out after too many retries. As far as I can tell, it never looks into cached images. I wouldn't know where they would be stored on my machine. The images in CUSTOM are loaded properly, internet or not. But those only came to be there because I downloaded them from scryfall using a script of my own. Version info:
I also see this in the logs upon startup:
|
thank you so much for your logs, they make it clear that there is a regression here, the new url cache (#4756) is not used when there is no network connection. |
This looks like it is https://bugreports.qt.io/browse/QTBUG-40151 — it is not that the cache is not used when offline, it is that redirects are not cached, and scryfall URLs are redirects (as can be seen in the log) :( At least this should be easier to fix, because we can just remember the resolved (post-redirect) URL associated with the card. I can reproduce the behavior now, but am fairly surprised — I specifically tested for this while writing #4756 and was fairly certain I had found a workaround by using the Edit: to clarify, the following lines in the log:
should have been:
(notice "following cached redirect" instead of "following redirect") Since the redirect is not cached, when there is no network connectivity, we never reach the second step, even though the image itself is cached on disk. |
Similar Requests
I searched for similar issues and there were some related ones (e.g. #4319) , that gave me an understanding of how I think the image downloading and caching currently works, but I could be mistaken.
Description of New Feature
Keep all the images downloaded on the fly, so they do not need to be ever redownloaded. A user can force redownload simply by deleting the image that he wants replaced.
Additional Context
Each of my Cockatrice sessions, the app redownloads all images of decks loaded into games. I can stop this behavior by downloading all images I need for my decks using an external script directly calling the scryfall API, storing these image files in the
../Cockatrice/pics/CUSTOM
directory, and disabling thedownload on the fly
option in settings/Card Sources. But then any image I may have missed is not downloaded and not shown. If I enable downloading on the fly, all images are always downloaded again (determined by the slower loading time and in the debug log) and the files in CUSTOM are ignored.I'm not entirely clear on how the caching currently works, but why isn't there an option to keep any image that was downloaded on the fly? Or is there an issue with my installation and is this feature request how the app is supposed to work? Some issues mention the folder
../Cockatrice/pics/downloadedPics
but I do not have that one. If I manually make one and populate it with images, they are still ignored if downloading on the fly is enabled.The text was updated successfully, but these errors were encountered: