Alternative to downloading pictures en masse
 Posted: 02 Nov 2010, 04:08
Posted: 02 Nov 2010, 04:08I'm trying to think of what to do about downloading set-specific images. Somehow, no matter what server source, leeching that many pictures is just bad karma for all of us....
So I started thinking about how I might be able to work around that.... First thoughts were to only allow one set to be downloaded at a time. Second, distribute the requests across multiple mirrors.
I considered the fact that the HQ pics are mirrored in particular folder structures, that can easily be assembled on the fly. For LQ, I considered writing a script to invoke ImageMagik running on a webhost to do the dirtywork for me.
And then I started looking back to where Forge actually loads the picture, and I realize that we have the opportunity to kill a few birds with one stone.
ImageCache, line 81:
HEEEEEYYY, wait a sec!
I set a breakpoint, and realize that it only attempts to load the file when it actually needs to draw it. Not at startup, not even when launching a game or the deck editor. Nope, only when it's drawn.
So if there's likely to be a few cards out of 5000 that we never will actually load, why do we need to have them on the drive? If we ever do need to see the card, how long does it take for Forge to grab the pic? (as long as there's internet.. but how often are you without? OK... mtgrares, is a big exception...) The worst case scenario (load-time-wise) is an opening hand of singletons that you have never seen before.
Certainly by spreading out the downloads, there is less impact on the servers, which would have been a legitimate gripe against us.
Thoughts?
			So I started thinking about how I might be able to work around that.... First thoughts were to only allow one set to be downloaded at a time. Second, distribute the requests across multiple mirrors.
I considered the fact that the HQ pics are mirrored in particular folder structures, that can easily be assembled on the fly. For LQ, I considered writing a script to invoke ImageMagik running on a webhost to do the dirtywork for me.
And then I started looking back to where Forge actually loads the picture, and I realize that we have the opportunity to kill a few birds with one stone.
ImageCache, line 81:
- Code: Select all
- File file = new File(path, key + ".jpg");
 if(!file.exists()) {
 //DEBUG
 //System.out.println("File not found, no image created: " + file);
 return null;
 }
HEEEEEYYY, wait a sec!
I set a breakpoint, and realize that it only attempts to load the file when it actually needs to draw it. Not at startup, not even when launching a game or the deck editor. Nope, only when it's drawn.
So if there's likely to be a few cards out of 5000 that we never will actually load, why do we need to have them on the drive? If we ever do need to see the card, how long does it take for Forge to grab the pic? (as long as there's internet.. but how often are you without? OK... mtgrares, is a big exception...) The worst case scenario (load-time-wise) is an opening hand of singletons that you have never seen before.
Certainly by spreading out the downloads, there is less impact on the servers, which would have been a legitimate gripe against us.
Thoughts?