Latest Blogs

Playlog Displayer

I never did show you the full source code for the playlog page, so here you go! One day I'll comment it for you :D

from mod_python import apache, util
from PIL import Image
import eyeD3 as id3
import MySQLdb, time, cStringIO

def handler(req):
args = util.parse_qs(req.args or "")
if args.has_key("pic"):
return pic(req, args["pic"])

return main(req)

def main(req):
req.content_type = "text/html"
req.write("""
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>theY4Kman's Playlog</title>
<link rel="stylesheet" href="style.css" />
</head>

<body>""")

db = MySQLdb.connect(host="localhost", user="root", passwd="fooledu", db="amarok")
crs = db.cursor()
crs.execute("""SELECT playlog.play_time, song_paths.song_path, song_paths.song_id
FROM playlog, song_paths
WHERE playlog.song_id = song_paths.song_id
ORDER BY playlog.play_time DESC
LIMIT 0,20""")

grey = False
res = crs.fetchone()
while res:
title = artist = album = "<none>"
year = ""

tag = id3.Tag()
try:
tag.link(res[1])
title = tag.getTitle()
artist = tag.getArtist()
album = tag.getAlbum()
year = tag.getYear()
except:
res = crs.fetchone()
continue

req.write("""
<div class="track %s">
<div class="basicinfo">
<div class="extendedinfo">
<br />
</div>

<em class="time">%s</em>
<div class="cover">
<img class="coverimg" src="music.py?pic=%s" />
</div>
<div class="trackinfo">
<strong>%s</strong>%s%s
</div>
</div>
</div>

"""
% ( ( grey != False and "bg1" or "bg2" ),
time.strftime( "%Z %I:%M%p %A, %B %d", time.localtime(res[0]) ),
res[2],
title,
artist != "" and ("<br /> by <strong>%s</strong>" % artist) or "",
album != "" and ("<br /> on <strong>%s</strong>" % album) or "" ) )

grey = not grey # Toggle between grey and white backgrounds.

res = crs.fetchone()

req.write("</none></body>n</html>")

return apache.OK

def pic(req, id):
req.content_type = "text/html"

db = MySQLdb.connect(host="localhost", user="root", passwd="fooledu", db="playlog")
crs = db.cursor()
crs.execute("SELECT song_path FROM songs WHERE song_id = %s LIMIT 1", id)

res = crs.fetchone()
if not res: return defaultpic(req)

tag = id3.Tag()

try:
tag.link(res[0])
imgs = tag.getImages()

if not tag or len(imgs) < 1: return defaultpic(req)

req.content_type = imgs[0].mimeType

im_str = cStringIO.StringIO(imgs[0].imageData)
im = Image.open(im_str)

if im.size[0] > 130:
im = im.resize( (130, 130), Image.ANTIALIAS )

im_str.close()
im_str = cStringIO.StringIO()
im.save(im_str, "JPEG")

req.write("%s" % im_str.getvalue())
im_str.close()
except:
return defaultpic(req)

return apache.OK

def defaultpic(req):
img = open("/home/they4kman/site/music/covers/__default.png", "rb")
if not img: return apache.OK

req.content_type = "image/png"
req.write(img.read())

img.close()

return apache.OK


Bread Clips

Bread Clip

Bread clips are the bane of my fridge-going experience. Most of the time our bags are sealed with twist ties, but occasionally these rotten crapples pop in to send salutations and a slap in the face.

When the bag has a twist tie, the usage is as simple as untwisting, retrieving the contents of the container, and retwisting. Not for bread clips, though. Oh, no, they can't be that easy. Trying to take them off yields ripped plastic and broken seals. One would be lucky to get the bag open enough to pull anything out. But if one is successful, failure is a sure shot when attempting to reapply the little buggers. However, if one somehow defies the Laws of the Kitchen and applies the clip, it's already bent three ways to hell.

Basically, bread clipping is akin to waterboarding. Some may construe it as legal, but it hurts everyone in the end (possibly kills, too).

Fuck bread clips.

LinkDestruct

<e_fermi> hey edteller
<e_fermi> i just figured out a great way to use a small fission bomb to ignite a thermonuclear fusion bomb
<edteller>Wow!
<e_fermi> Yeah, I published it on my wobsite: http://totallyexistedin1941.mil/~fermi/thermonuclearbomb.htm
<[NaZi]hitler>MWUAHAHAHA! Your secrets are mine!
* [NaZi]hitler destroys America, Britain, and Canada

Has this ever happened to you? It wouldn't have, if only you had used a self-destructing link!

What's a self-destructing link, you say?
A self-destructing link is a URL that redirects to a specified hidden URL until certain limits are reached, such as amount of views or time. If X amount of people have visited the URL or Y amount of seconds/minutes/hours/days/eons have passed, the URL will no longer redirect to the hidden URL.

Boy, theY4Kman, that sounds even cooler than falling and missing the ground. How do I create my own self-destroyerzing thingamadoodads?
Well, avid reader, I'm pleased to inform you that I've created such a site for your eyes only! Just head on over to LinkDestruct (http://linkdestruct.com), follow the instructions, and you'll be off in no time growing generating your very own ch-ch-chia self-destructing links.

What was that link again?
http://linkdestruct.com
Er?
That number again was 1-800-DESTROY (1-800-337-8769)

Don't forget to Share and Enjoy!

Vegas Videos

I picked up Sony Vegas a while back. Vegas is a video editing software, and it's damn good. Video editing is a skill I'd like to have, as it can be very useful for tech demos, frag videos, and just some screwing around, like so:


Saving Private Ryan: Where Is My Mind?

Saving Private Ryan: Where Is My Mind? (Take 2)

These videos are a product of my boredom and struggle quest for knowledge. I learned some valuable stuff in making them; one of those things being that the Pixies kick ass :)

It's a good game you see, mmkay?

There are a few things that I'd love to see in games, but I've yet to see perfected. I don't think they're very hard tasks to accomplish, but I'm a regular Joe-idiot.

  • Squad based gameplay

    Yes, BF2 had a great run with this, but it didn't really perfect it. Without enough squad-only commands, you were forced to wait for a commander who knew what he was doing tactics-wise and knew how to use the commander tools.

  • Player customization

    I here this is coming in Insurgency Beta 2, which I'm definitely gonna download to see if it's as great as it looks. Anyways, I've seen but a few games with this in it, and their names escape me, so they must have really sucked. I like to be able to change what I look like; to make my character very personal...And not just my arsenal of weapons. A game that doesn't let you do that sucks in the first place (*COUGH* Insurgency *COUGH*)

    I remembered a few of those games. There's Halo that lets you do something like this...I'll try to find some more in my memory.

  • Overview map

    Well, after I wrote that title, I realized that BF2 really perfected this one. My box can't handle BF2, though, so get cracking, HL2 mods! Yeah, you, Insurgency! I HAD HIGH HOPES! HIGH FUCKING HOPES!


Edit (02/10/08): I lied. I still haven't downloaded Insurgency Beta 2, or whatever the version is up to now. I've been way too preoccupied with coding and Team Fortress 2. More with TF2, though :P

« Previous 2 3 4 5 6 Next »