[ rexroof.com ] [ biking ] [ blog ] [ work ] [ disposable ] [ crap ] [ code ] [ phone ] [ pictures ] [ yank ] [ url ] [ linklog ]

Thursday, February 10, 2005

pladd

I've written this script a half-dozen times at least, but this is the first one that doesn't use Mac::iTunes to create the playlist. I needed something that would add a directory of mp3s to a playlist in itunes with the same name as the directory, so I wrote this:


#!/usr/bin/perl
use strict; $|++;
use warnings;
use Mac::Glue qw(:all);
my $itunes = Mac::Glue->new("iTunes");

my $dir = shift;
die "specify directory on command line\n" unless ( $dir and -d $dir );
my $playlist = $dir;
$playlist =~ s/\///g;
$playlist =~ s/\s+/_/g;

die "no playlist found\n" unless ($playlist =~ m/[a-zA-Z]/);

# check the playlist total time to see if the playlist exists already.
# $pl_time will be null if playlist doesn't exist, "0:00" for empty playlist
my $pl_time = $itunes->obj(playlist=>$playlist)->prop('time')->get;
if ($pl_time) {
print "playlist exists!\n";
} else {
$itunes->make(new => 'playlist', with_properties => { name => $playlist });
}

opendir DIR, $dir or die $!;
# only adding songs m4a, m4b, and mp3s.
my @file_list = grep { /(mp3|m4[ab])$/i } readdir (DIR);

foreach my $file (@file_list) {
print $file, $/;
# add files to playlist.
$itunes->add("$dir/$file", to => $itunes->obj(playlist=>$playlist));
# remove original
unlink "$dir/$file" or warn $!;
}



you can also find it on the code section of my webpage here.

Thursday, February 03, 2005

imunge roxorz!

I love imunge!
I had some songs with annoying song names in all caps, with the help of ernie I wrote this imunge command:

imunge -s -r '.+' -P '\L$&'

beautiful!

Tuesday, February 01, 2005

Rip and Burn DVDs

How to copy a dvd and burn it to DVD on my mac powerbook:


  1. Rip the DVD using MacTheRipper. this copies it to the hard drive and removes DSS.

  2. Open VirtualPC


    • mount home directory as samba share drive (for some reason the virtual PC built in file sharing won't work with most XP progams I've tried. it makes things crash.)

    • use DVDShrink to reencode files to fit on one burned DVD


      • click Open Files, pick where you saved with MacTheRipper, turn off video preview.

      • Set save to folder and choose the Desktop on the share.

      • Make sure you're saving Region Free and turn on Deep Analysis and Smooth high quality error correction.

      • Click OK and make sure video preview is off again. wait 2 hours. I suggest sleeping.


    • Close Virtual PC


  3. Burn the resulting directories with Toast 6 to a DVD. Just drag the folder on the desktop into Toast with the DVD Data Disc option chosen.

  4. Delete the files that MacTheRipper and DVDShrink made. should be about 5-6 gigs total.