Declartion

And/Oh welcome to this world, have as much fun as you would like while helping others have as much fun as you are having. Be kind to those you love, and be kind to those you don't. But for Gods sake you gotta be kind, and respectful because we're all one soul. Be the best fucking human you could be!
Today, I the author am declaring my intention to live. I'm tired of my jello-y existence. I am going to love freely. Lavish compliments. Help everyone.

I will shine these words on my mind forcing negativity and criticism to crumble at conception. Let the waves of cynicism surrounding me go no further; sink them, squish them, and combust them into midnight bike rides, shouts of exuberance, impassioned fucking, and tottering piles of chopped vegetables!

When I find my resolve threatened I will turn to my own ingenuity and rummage through the junk drawer of my existence determined to find the improvised implements necessary to carry out these words.

I am strong; but I will need your help.

Tuesday, September 29, 2009

Recording Internet Radio Shows with Cron

This is a short script I threw together this morning to capture shows for myself.
 
#!/usr/bin/python

"""
streamdownloader.py

Script for downloading streaming mp3 files from internet radio sites for
a specified amount of time. Intended to be useful as something run from cron
and record your favourite shows. Have a lot of fun!

Usage:      $ ./streamdownloader.py <stream> <output filename> <length in minutes>
Example:    $ ./streamdownloader.py http://trentradio.ca:8800/hi-fi.ogg trent.ogg 60

Chad Mounteny
readability@gmail.com
September 2009

Should work great for Linux, have no idea otherwise.
"""

import urllib
import time
import sys

def main():
    while now() - length < start:
        data = conn.read(100)
        target.write(data)
       
def now():
    return int(time.time())
   
stream = sys.argv[1]
dest = sys.argv[2]
length = int(sys.argv[3])*60
start = now()
conn = urllib.urlopen(stream)
target = open(dest, 'wb')

if __name__ == "__main__":
    main()

0 comments: