soledad penadés
repeat 4[fd 100 rt 90]

Archive for August, 2008

20080826 Create .ZIPs from multiple folders

There we go with yet another exercise in Python :-)

The idea here is to archive several folders, having each folder in a ZIP file. So if you have two folders, A and B, you end up with A.zip and B.zip.

No doubt this can be done with shell programming (and it will be much better since this solution doesn't provide support for recursion) but this is intended as a way of improving my python skills, so no moaning about the choice of language here! ;-)

And here is the little script:

import os
import sys
import zipfile

if len(sys.argv) > 1:
        folder = sys.argv[1]
else:
        folder = '.'
       
for item in os.listdir(folder):
       
        full_path = os.path.join(folder, item)
       
        if not os.path.isdir(full_path):
                continue
       
        dst_filename = item + '.zip'
       
        dst_item = os.path.join(folder, dst_filename)
       
       
        if os.path.exists(dst_item) and os.path.getsize(dst_item) > 0:
                continue
       
        output_file = zipfile.ZipFile(dst_item, "w", zipfile.ZIP_DEFLATED)
       
        for item_file in os.listdir(full_path):
                output_file.write(os.path.join(full_path, item_file), item_file)
               
        output_file.close()

You can download it from my supersnippets repository, and then execute it with

python zip_folders.py name_of_folder_to_process

Maybe changing the way I do the imports would help, so instead of doing import os and then using os.listdir, I would write from os import listdir and then simply use listdir from then on, but for some reason I kind of prefer the more verbose way for now, so that I don't have to guess where does each function come from.

I suppose once I get more fluent with Python, I won't need to use those long statements.

20080804 Neon v2 goes open source

Neon v2

If you're interested in VJ software, you may probably have heard about Neon v2, the VJ application that shine/xplsv.com developed a few years ago and which has been used not only for lots of VJ gigs but also for creating several real-time demos (including the euskal 2005 winner demo, Sound Pressure)

Unfortunately Shine is very busy right now. But instead of letting the software stagnate, he has made the full sources available under a GPL license, for whoever wants to pick up the development. This pretty much follows the story of Neon v1: when the author (mac/xplsv.com) got too busy, he released the sources for Neon V1 and Shine continued it, creating Neon v2 a while after.

You can check the sources from the SVN repository with your favourite SVN tool, or just be curious and browse them. It has lots of interesting stuff in it. Some examples that come to mind:

  • a full real-time 3d engine, with support for pixel and vertex shaders for building really cool effects
  • 3dsmax mesh export plug-in - if you want to know how to build a plug in for 3dsmax, here's an example
  • integration with Lua for scripting - allows you to use the engine features programmatically
  • video play, using native windows video support and also ffmpeg for other formats
  • custom skinnable gui

etc etc etc… there are more things but I'll let you find out by yourself!

As Shine says in the news, if you make new features for it, contact him and we'll include them on the repository. If the updating gets active we could then manage new users with write-access for the SVN.

I personally wish someone with better knowledge of OpenGL and GUI's than me would port the software to Mac/Linux (fingers crossed). It would be awesome to have it working without depending on DirectX as it does now (hint hint hint!)