logo

ShrimpWorks

// why am I so n00b?

A long time ago, in a galaxy not far away, I created a very small application named SaveScreen. Today I’m rather pleased to release a much-improved SaveScreen 2.

A couple of anti-virus applications complained that the .dll file distributed with SaveScreen which enabled detecting when “Print Screen” was pressed, was a virus or malware of some sort, so even I was unable to use SaveScreen, which made my cry.

Finally fed up, I set out to resolve the situation by creating a brand new application which did not rely on random keyboard hooks and stuff. The result is SaveScreen 2.

In addition to no longer being flagged as a virus, SaveScreen 2 features direct ImageShack posting (complete with automatic forum code creation and thumbnail support), and FTP uploads of screenshots. Something which may be rather handy (just don’t take a screenshot of your bank statement then complain when the whole world is exposed to it - use with care). Also, it can save screenshots in per-application folders, making organisation somewhat neater.

Heh, I guess there are already plenty of tools out there which do this sort of thing already (never seen them personally, but then I’ve never looked either, heh), but this only took me half an evening to throw together anyway.

Basically, it’s a Python (uses youtube-dl) and PHP-powered web-based YouTube video downloader and converter, you just stick in the URL to a YouTube clip you want to save, and it will download it and offer it for download as an MPEG which you can save on your PC and play in all it’s low-quality glory whenever you want.

Basically it automates the following, which can be run on any Linux PC:

# youtube-dl.py -o myvid.flv http://www.youtube.com/watch?v=123abc # ffmpeg -i myvid.flv -ab 56 -ar 22050 -b 500 -s 320x240 myvid.mpeg

As an added benefit, it stores a complete history of downloaded clips, so you and others can re-download them at any time without having to do the whole fetch/convert process over again. Plus it uses a nifty fake AJAX waiting effect :P.

Requires Linux with ffmpeg, Python 2.4+, and PHP 4.3+.

Since the XBox Live “GamerCards” are so nicely exposed, there’s really no reason not to have a DynaBar plugin for it, now is there.

I’ve noticed a few GamerCards claiming to be in “userbar” format, however they do not follow userbar standards in layout, dimensions, or fonts. So, soon you too can have a lovely dynamic standards-compliant GamerScore userbar such as this:

After the release of the “Dumb Image Browser”, (which worked/works very well for what it’s supposed to do), I thought of prettying it up a bit, and adding some extra features.

The result is the Nice Image Browser. It’s vastly improved in terms of visuals, as well as offering features like easier browsing around the galleries, easy creation of new galleries, and uploading files directly from the browser.

It maintains the same PHP5-powered, database-less, cache-less, auto-thumbnail generating system of the Dumb Image Browser, meaning it’s just as easy to get set up (copy the files to a directory you want to become your gallery).

Thanks to Korpse/k4y/K` for the new stylesheet used for displaying the thumbnails.

The ReadMe includes usage and setup instructions. Happy image browsing! :)

Hmmmmm, long time no update. That’s not to say I haven’t been busy recently.

Last month, we released “UnWheel R5”, which seems to have become the (hopefully) final release. I’m pretty happy with it at the moment, all the major bugs are gone, multiplayer is working wonderfully and the online record system is churning records around at a mean rate (and those records still need a monthly rotation system applied, so still some work to be done there). I still haven’t decided if I want to do this all again in Unreal Torunament 2007 or not :).

Elsewhere, I’ve been playing around with DynaBar, and it’s grown a lot. The plugin system has been tweaked to allow better customisation options from the developer side, as well as having options added to improve the user interaction side of things. There are a whole crapload of other options available as well, multiple layers (supporting PNG graphics with alpha transparency), different scanline styles, text prefixes and suffixes, better caching options, etc. In addition, you can choose to have the background be a gradient blending between any two colours, horizontal or vertical, and you can create “groups”, which is a bunch of userbars animated (with fading/blending between bars), and they all remain fully dynamic. Speaking of dynamic, I’ve also added a whole load of plugins, from XFire, to more Last.FM options, to Battlefield 2 and TrackMania, and even RSS headlines and live game server status via Qstat.

I’ve put up a test system here as a sort of sandbox, so feel free to try out all the options and plugins, and if you have any suggestions or ideas for plugins, please let me know. In addition to the designer, there’s a browser available, which lets you easily build the animated groups mentioned above. Also, it all works with Internet Explorer now, which I didn’t bother fixing with the previous version (wasn’t meant to be such a “big” project :)). Source code package will be available as soon as some more testing is done.

In addition, I’ve been re-writing my online Dosage-powered comic viewer - Injector

  • again, this time it’s going fully “Web 2.0” (ZOMG!), so everything’s quite nice and quick. This project still needs a bit of work on the administration and installation side of things before it can see a release.

Aside from all that, I’ve also been slowly building a new UnrealZA site, using the Python-powered Django framework. It really is a wonderful thing. Please excuse me for a minute while I run away from a horde of crazy, twisted, Nevow fans (among others). Anyway, I’ll happily recommend Django any day of the week to anyone looking for a Python web framework.

I’ve also decided I don’t like the look of this site anymore, so I guess that’s another thing to go on my to-do list for the near future.

Created two very basic scripts this past week:

The first, a basic Image Browser:

Basically, I really hate trying to set up and use normal image publishing/gallery software. Something like Gallery is pretty nice and feature packed, but for putting a photo of your cat online, it’s pretty much a mission, with users, permissions, logins, galleries, categories, grouping, keywords, thumbnail options, etc, etc. I just want to upload a JPEG and say that’s the end of it, but still have ti browsable with some thumbnails that didn’t take me 10 minutes to create in Photoshop.

Anyway, yar. So I made this script. It’s actually a pair of scripts. A basic browser interface that simply goes through a directory, finds all images, links to them, and shows thumbnails of them via the second script - a basic thumbnail generator.

So ‘installation’ is simply dropping this pair of scripts into the directory you want to publish your images from, and it’s done. Any sub-directories will be navigable, so you can use them as ‘categories’ if you’d like. Since the thumbnails are generated on the fly as needed, there’s no database or anything, and adding a new image is as simple as dropping the file into your image directory.

The second script, is a Download Tracker:

Extremely simple again, simply does a count of hits on any file passed to the file.php script. The files can be located anywhere on the system (so if you really don’t want people getting at your files without going through the counter, they can be outside of your www published path).

Again, I was going for simplicity here, so there’s no massive upload manager UI, or snazzy hit monitoring UI, or a 5000 table MySQL database. It keeps track of the hits by simply storing them in a regular PHP array, and then serializing this array to a file. Next time the file it requested, the hit log file is loaded, then unserialized into the array, the array is updated and serialized again. :). So you’ll need to make sure the files.log file is writable by the web server (or the whole directory the tracker files are in). It also requires PHP5, unless you write replacement functions for file_get_contents() and file_put_contents() on earlier PHP versions.

Link to a file as follows: http://my-site.za.net/file.php?installer.exe, or even http://my-site.za.net/file.php?path/to/document.pdf

You can then view the hits and things via the file_stats.php which outputs a very basic tabular representation of the stats the hit log tracks.

Both of these packages’ code is pretty well documented, so if anything, they may be educational so you can build more exciting versions of these. However, as they are, they serve my needs, but just thought I’d share anyway ;).

Usage instructions are also within the code.

I’ve had to do quite a bit of stuff with images in Delphi recently (lots of manual drawing too), and discovered TCanvas’ TextOut method will only draw text onto one line, line breaks and newlines are ignored. Google search results suggested Windows’ DrawText function, however despite all the formatting and alignment flags it takes, it refused to draw text centred vertically.

Anyway, here’s a small-ish procedure which will take your multi-line text, and draw it centred on the canvas you pass it. You also need to pass the width and height of the canvas you’re drawing to. It assumes the font can everything else has been set by you, prior to calling it. Also, be sure “Graphics” is in your “uses” section.

procedure multilineCanvasText(canvas: TCanvas; text: String; width, height: Integer);
var
  textSize: TSize;
  lines: TStringList;
  i, blockHeight: Integer;
begin
  // lazy man's way of splitting text by line into a list (split by #13#10)
  lines := TStringList.Create;
  lines.Text := text;

  // see how high our block of text is going to be, based on the font the canvas
  // currently has set
  textSize := canvas.TextExtent('LOZL!');
  blockHeight := textSize.cy * lines.Count;
  blockHeight := blockHeight;

  // go through each line and output it
  for i := 0 to lines.Count - 1 do
  begin
    // we need the width of each line, so we can center it on the canvas
    textSize := canvas.TextExtent(lines[i]);
    // render the text
    canvas.TextOut((width div 2) - (textSize.cx div 2),
                   (height div 2) - (blockHeight div 2) + (textSize.cy * i),
                   lines[i]);
  end;
  freeAndNull(lines);
end;