Import Soul Wouldn’t it be nice if things just worked

17May/112

Cleaning up the itunes media directory

In the process of moving my iTunes library to my new laptop (well its not so new anymore), iTunes has somehow managed to duplicate my entire library, creating a copy of every track, movie, tv show ect, and giving the duplicate some obfuscated name, i.e. ABCD.mp4

Besides being a large bunch of unnecessary files, they eat up a lot of HDD space, around 100GB.

After finally finding out what was eating up my HDD space it was easy to write a quick little python script to find and remove all of these files.

import re, shutil, os

CLEAN_FROM = r"C:\Users\Hugh\Music\iTunes\iTunes Media"
CLEAN_TO = r"C:\Users\Hugh\Desktop\junk"

FILETYPES = ["mp4","m4a"]

if not os.path.exists(CLEAN_TO):
    os.makedirs(CLEAN_TO)

pat = re.compile("[A-Z]{4}[.](%s)"%"|".join(FILETYPES))

print "Starting"
for dirpath, dirnames, filenames in os.walk(CLEAN_FROM):
    for fname in filenames:
        if re.match(pat,fname):
            shutil.move(os.path.join(dirpath,fname),os.path.join(CLEAN_TO,fname))
            print "Moved: "+fname
print "Done"

I do not guarantee this script will work for you and check what you actually delete before you actually do it

11Mar/110

Squiglet – Now with examples

Just a little progress report to say that my vector library is nearing V1 and i will soon be able to resume work on Saga of Sol.

As of yet i just need to tweak the draw function of the vectors to fix an odd bug where the lines will have gaps near the corners of some shapes as well as adding some more functionality to the editor.

Editor View

Example View

As usual the project is available HERE

10Mar/110

book-expander

As messing around getting some ebooks onto my nice new kindle, i have run across the problem where some books have been poorly OCRed and have lost a few spaces along the way. i.e. "Monty python" may become "Montypython"

To combat this i have written up a little script that will search though and try to identify and correct where this has happened.

Currently i have it all setup and hard-coded for use on ZIP/HTML exports from calibre returning a new zip that can be re imported. If you are interested in using the functionality on just plain text feel free to download it and use the clean_book function.

All the code and bug tracker can be found HERE on GitHub

1Mar/110

Enter Squiglet

The graphics style i have chosen for the game i am working on, Saga of Sol, is very simple. The majority of the graphics such as ships, buildings, will be composed only of plain old white on black lines, with some "highlight" or "feature" lines being drawn a different colour to denote what team it is on.

I didn't think that it was appropriate to go for a full on vector/SVG library for pyglet such as Squirtle. So i have begun the creation of my own much simpler vector library "squiglet" that will handle the graphics for my game.

As of yet i have the basis of most of the vector classes complete (no functions yet to draw them into the game) and am about 80% of the way done on my own editor for the vectors.

If your interested in the project it can be found on GitHub at https://github.com/Hugoagogo/squiglet or you can follow along on my blog HERE

6Sep/102

And So Ends NCSS 2010

The past weekend has been a large on in programming for me, having both the finals for Progcomp (Run by the university of NSW) and the last week of the NCSS programming challenge.

In Progcomp my team managed to soar up the ladder from last in the finals to second last  (that's still 6th place out of 13o teams or so overall) and was utterly flattened by James Ruse who finished all the challenges in an amazing 1:40. We Still had an awesome time going up to Sydney and having a look around the university on its open day and we look forwards to hopefully being back next year.

Last week was also the final week of the NCSS challenge where you are given 5 problems to solve for 5 weeks. The beginners division of this competition is a great way it get into learning programming/python if you are interested. This year i entered the advanced division and managed to place 11th on 188 points solving all the questions except for the last and rather evil Peg Solitaire question (worth 20 points instead of the usual 10) . I am reasonably happy with this and hopefully i am able to move up the board a bit more next year and so ends NCSS 2010.