Sunday, May 24, 2009

Foxit PDF Reader

I was loading up the latest Adobe Acrobat reader in Windows XP the other day—it took forever! And, it took forever to open. Total, complete bloatware! What is with that? It's just a PDF viewer—or at least it should be...

Enter Foxit Reader 3.0

Man, now that's just what I needed. A PDF reader that isn't hundreds of MBs, integrates with Firefox, opens quickly and displays properly. Get it.

Wednesday, May 13, 2009

FLAC To .ogg Vorbis

Funny how things go full circle sometimes. I initially worked on converting all of my music CDs to Vorbis files, a tedious and rather boring adventure in itself. I was reminded during a conversation on slashdot that it might be wiser to convert to FLAC first and then I could transcode into lesser quality codecs when needed. I thought it was a reasonable idea—too bad I had all my music in Vorbis format at the time! There's no way of going up in quality...

Time went by. I started another media-shift project, this time CD to FLAC, as I should have done in the first place. Now I actually have items in that collection that I need to transfer down to Vorbis! Ironic... such is life.

Enter our friend oggenc. Simple & effective, yet how to do entire directories in one shot? Fret not, there is nothing to it:

cd /dir/with/flacs
oggenc -q6 *.flac


I'm transcoding some files now that don't appear to have any tag info, so I'm not sure that transfers, but otherwise it is working swimmingly.

Here's a perl script option that might be more useful, but I haven't tried it so your mileage may vary:

#!/usr/bin/perl
#
# Copyright (c) 2004 - Jason L. Buberel - jason@xxxxxxxxxxx
# Licensed under the GNU GPL.
#
# Modified by Dax Kelson to run on a native UNIX/Linux box.

use Getopt::Long;
use File::stat;

$sourceDirPrefix = "/export/media/music/flacs";
$destDirPrefix = "/export/media/music/oggs";
$quality = 5;
GetOptions ( "source:s" => \$sourceDirPrefix,
"dest:s" => \$destDirPrefix,
"quality:i" => \$quality,
"force" => \$force );

# Commands
$oggCommand = "oggenc";
$flacCommand = "flac";

@dirs = `cd "$sourceDirPrefix" && find . -type d -print`;
@files = `cd "$sourceDirPrefix" && find . -type f -name "*.flac" -print`;

# Check to see if our find command found anything to convert.
if ( scalar @files == 0 ) {
die "Found no .flac files to convert!";
}

# recreate the directory hierarchy
foreach $dir (@dirs) {
$dir =~ s/\n$//;
$dir =~ s/^\.\///;

# check to see if the destination dir already exists
if ( !(stat ("$destDirPrefix/$dir")) ) {
# stat failed so create the directory
print "Creating output dir:\n $destDirPrefix/$dir\n";
$dir =~ s/\`/\'/g;
$result = `cd "$destDirPrefix" && mkdir -p "$dir"`;
}


}

# now process the actual sound files.
foreach $file (@files) {
$file =~ s/\n$//;
$file =~ s/^\.\///;

# figure out what the destination file would be...
$destinationFile = $file;
$destinationFile =~ s/\.flac*/\.ogg/;

# now stat the destinationFile, and see if it's date is more recent
# than that of the original file. If so, we re-encode.
# we also re-encode if the user supplied --force
$srcInfo = stat ("$sourceDirPrefix/$file");
$srcModTime = $srcInfo->mtime;
$destInfo = stat ("$destDirPrefix/$destinationFile");
if ( $destInfo ) {
$destModTime = $destInfo->mtime;
print "Skipping current file: $destDirPrefix/$destinationFile\n";
}
# if the destination file does not exist, or the user specified force,
# or the srcfile is more recent then the dest file, we encode.
if ( !$destInfo || $force || ( $srcModTime > $destModTime) ) {
$file =~ s/\`/\'/g;
$inFile = "$sourceDirPrefix/$file";
$outFile = "$destDirPrefix/$destinationFile";
$inFile =~ s/\0//g; $outFile =~ s/\0//g;
$result = `$oggCommand -q $quality -o "$outFile" "$inFile"`;
}

}

Sunday, May 03, 2009

Metamorphose File - Folder Renaming

This is a pretty cool application. Something that should be brainlessly easy under the command line in Linux—all I wanted to do was replace one character in all the filenames in one directory. Well, I ended my search when I found Metamorphose—a Windows app that would do the trick which I could run against the filenames since the directory is on a Samba share. In seconds it was all over.

It makes me unhappy when something which should be blatantly easy from the command line ends up requiring a Windows application. Well, I'm sure it is simple. I'm pretty certain I even know how to do it. If so... I forgot...

Old age or Too Much Information