Thursday, December 30, 2004

Wired writes about bittorrent and its creator Bram Cohen.

Listen to this article Listen to this article

Thursday, December 23, 2004

Shell script to convert aiff file to mp3 and add id3 tags using lame and id3tool

I am working on a shell script to help Michael Geoghegan of Reel Reviews podcast fame in his podcast production. I though I would post this as it may be of use to other podcasters. It is setup for OSX but should work on any *nix OS with minor changes. Windows version is possible but would probably have to be a vbscript or batch file or something of that order.

1. it converts any aiff file dropped into a folder to a 64kbps mono mp3 file (scanned every 10 seconds)
2. Adds some of the id3 tags:
- name: Reel-(the date)
-author: Michael Geoghegan
- album: Reel Reviews
-Comments (note):
-Year (the current year)
3. Moves the aiff files to an aiff subfolder
4. Moves the processed mp3 file to a mp3s subfolder

Here is the script source:

#! /bin/bash
while ((1));
for aifffile in *.aiff;
base=`basename $aifffile .aiff`
my_date=`date "+%m-%d-%Y"`
my_year=`date "+%Y"`

lame -h -m m -b 64 $base.aiff $base.mp3
id3tool $base.mp3 -r "Michael Geoghegan" -y $my_year -t "Reel-$my_date" -a "Reel Reviews" -n "$my_note1"
mv $base.aiff aiffs
mv $base.mp3 mp3s
sleep 10;

There is a bit of setup to do. Setup assumes OSX 10.3, lame and id3tool are installed. I had to compile lame and id3tool. Suposedly you can install them with fink in OSX but I couldn't get it to work so I just downloaded the source for these 2 and did it myself.

so to use the script
-install lame and id3tool.
-create a bin folder in your home directory /Users/your-user-name/bin
-create subfolders in bin called aiffs and mp3s
-copy the attached file (podcast.bsh) to the bin folder
-change the permissions of the podcast.bsh so it can execute.
-To do this open the terminal in /Applications/Utilities/Terminal.
- Type cd bin (return)
- Then type chmod 755 podcast.bsh
- Last type ./podcast.bsh (you have to keep the terminal application and window open (but you can minimize it to the dock)

Now any aiff file dropped in the bin folder is converted, id3 tags added and moved to the mp3s subfolder.

Here is what is left to make it really work well.

1. Testing. I just tested this on one very short system beep aiff file. Need to make sure it works with bigger files - it should but need to be tested
2. Prompt you for the name of the film. The script already just grabs the date from the computer. This part may need to be done in applescript - which is ok for OSX bu how could this be done to make it portable to other OSes?
3. Do the artwork thing. How do you do this? Drag the photo file into the iTunes artwork window? Does the artwork thing work with other media apps besides iTunes?
4. The id3tool seem to only allow a short snippet of text in the comment (note) tag, I wasn't able to put in the line breaks either.
5. Seems to me it would be useful to have it automatically ftp the mp3 wherever it needs to go no?

Listen to this article Listen to this article

Friday, December 17, 2004

Batch convert word docs to pdf (unix version)

This is a Bash shell script to convert word docs into pdfs. It uses a command line tool called Antiword to read the Word document and output it to postscript.

Then it uses ghostscript to convert it to pdf. It also checks the folder every 60 seconds to see if a new file has been added and processes it.

It's not perfect but mostly works well. Obviously you need to install Antiword and Ghostscript and make sure they are in you Path variable. 100% Microsoft and Adobe free:

#! /bin/bash
while ((1));
for docfile in *.doc;
antiword -i O -p letter $docfile | pstopdf -i -o ${docfile%.+([!/])}.pdf;
rm $docfile
sleep 60;

Listen to this article Listen to this article

Batch convert word documents to pdf (Windows Version)

So I needed to convert 90 word documents to pdf today and the thought of opening up 90 documents and printing them really was really depressing so I made a small vbscript to do it. I was also frustrated by the fact I could not find a ready to use script by searching in google so I made one.

Even though I have Word 2004 and Acrobat Professional 6.0, I couldn't see a way to convert all of them to pdf without opening them individually.

So here is the script (in Word go to Tools->Macros->Visual Basic Editor) click "normal" on the left side tree and click Microsoft Word Object and then double click This Document

Paste in this code:

Sub main()
'** Change the my path variable to the path to your folder full of word docs
myPath = "U:\LAW\syllabi_SP05\docs-toprocess"
Set fso = CreateObject("Scripting.FileSystemObject")
Set Files = fso.GetFolder(myPath).Files
Set app = New Word.Application
For Each file In Files
app.Visible = True
app.Documents.Open (file.Path)

Set app = Nothing
End Sub

Be sure to change the path as noted above.

Now the trick is to have a PDF Printer set up as your default printer to print (save) the files to the folder you want. So I hade to make a new printer and create a new port (Adobe PDF port)
set t save to the folder I wanted the files to go to.

Works great 90 word docs were converted in about 3 minutes (unfortunately it took me 2 hours to make the script - oh well next time I will save a lot of time).

You should be able to substitue ghostcript for Adobe Acrobat with a little tinkering.

I also tried to make a unix shell script to do this using a program called Antiword and ghostscript. It worked pretty well. I'll post that later if I can find it

Listen to this article Listen to this article

Wednesday, December 08, 2004

Hello World

Push button publishing huh? Sounds like my Dad might be able to do it.

Listen to this article Listen to this article