Random Screenshots

Random Screenshots

Last night didn’t go exactly as expected, largely because I did essentially zero gaming.  What happened instead is that I wound up installing Visual Studio community edition and tinking away all night at an idea I have had for awhile.  In order for it to make sense you are going to have to know a few things.  Firstly I take my game screenshots probably way more seriously than most people.  The theory is that since I have to summon a blog post every morning, and use screenshots to break up my blocks of text…  I need access to them quickly and at a moments notice.  Functionally I have thirty minutes to an hour to write every morning, so speed is of the essence.  As a result I have directory system out on 4 terabyte network attached storage drive, that first breaks games up into larger categories like MMORPG or FPS and eventually down into individual game directories.  Functionally feeding this beast would be madness were it not for the fact that I circumvent the screenshot routines of individual games, and dump every single screenshot I take into a “gameshots” directory.  I’ve tried a lot of different solutions and through them all.. the most reliable option has always been Fraps so I continue to use it…  in spite of how clunky it can be sometimes.  About once a month I clean these individual gameshot directories on my desktop and laptop and dump the images laying around into the directory structure on the network attached storage.  I still wish there was a direct way for me to connect into my PS4 screenshots over the network, but for the time being I have been using a second twitter account to export them without spamming my main twitter feed.

Random Screenshots

The second piece of information that is going to be key… is that some time ago I had an idea for a post prompt for those days I am struggling to find any purpose.  The idea being to take a random screenshot or two and then write about whatever happened to be going on when I was taking them.  The challenge then becomes how does one grab a random screenshot when you have a multi-tier directory structure that includes over 13,000 files.  This seed was planted around Blaugust time last year but I never actually got around to building it.  For whatever reason last night I sat down while eating dinner… and knocked it out over the course of the evening.  It is still rather crude and doesn’t look amazing, but as the night went on I kept adding different features to it.  The functionality is pretty simple… you use the file picker to choose the directory you want to crawl for screenshots.  If you wanted sheer madness you could of course start at the root of C and crawl downwards, because I believe that would work given that I am using recursion to make the crawl.  When you click search it is going to go out and find any JPG or PNG files and dump them into a list, then after completion dump links to those files out below the progress bar.  You can of course click the links to preview what it brought back.  I tried to make it work with picture boxes but given the 1080p file sizes kept blowing up the memory allocation.  I might rewrite at some point in the future and dump the links into an in app web browser for display.  Sidenote…  the progress bar starts out as complete bullshit but as you run the app remembers how many files it found last time and bases it off of that.  One of the things you will know as a programmer is that progress bars in general…  are bullshit.

Random Screenshots

At the moment when you hit search it brings back eight files and displays them as links.  At some point in the future I want to rework this process and use some sort of an object that is easier to add elements to on the fly, rather than a bunch of linklabels as I did last night… because I was lazy.  I would like to have a drop down that lets you choose from some values on how many files to return each search.  Right now I am caching the two directories and the number of files it found on its last run to the app.config, largely because I got tired of having to keep entering the same values each time I ran the application.  I am using app.config because I really don’t want to have to write things to the registry… and I am sure you don’t really want me to do that either.  The final feature to talk about is the save button, that attempts to copy any files found in the search to the directory you have chosen.  I say try because there are of course things that could go wrong along the process.  This morning when I ran it on a new machine for whatever reason it saved the files one directory up from my intended target.  I will have to sort that out and figure out why the behavior isn’t quite functioning as intended.  Whatever the case I’ve zipped up the current build and dropped it on my web host if anyone has a real burning desire to play with it.  It is a 7z file so you will need 7zip to deflate it… largely because I have an obsessive love for that utility.  If there is any demand I will probably throw it up on GitHub and start working off of that, since I don’t really have a great version control option at home.

Random Screenshots

For those curious… the images I have been interweaving throughout this post were pulled using the random tool this morning.  Just like with any randomizer there are going to be sequences of things closely tied together.  This morning it returned:  Diablo 3, Everquest 2, Fallout 4, Final Fantasy XIV, Final Fantasy V, and three shots from World of Warcraft.  So if you are looking for shots from a bunch of different games you might need to spin the wheel more than once to see what shakes out.  I’ve run it before and everything that was chosen save for a couple files are from my Final Fantasy XIV directory.  Granted in my case… I have way more screenshots of WoW and FFXIV than pretty much anything else in the directory structure with FFXIV containing 3,071 files and WoW containing 1,462 files.  Though in theory the WoW Directory is not a true representation given that I have a bunch of files on Google Photos that predate the NAS idea.  I also have literally every hard drive I have ever used sitting in a stack, and I have as a weekend project at some point to crawl through them looking for old game screenshots to add to the collection.  Generally speaking I donate all of my computers to Goodwill, but before doing so I pull the hard drive… and you end up with a stack of 20-30 drives over the course of a couple decades.  Here is hoping that they still spin after all of this time.  Let me know if you end up playing with this and what your results are.

 

Leave a Reply