*Really* Stupid Mac::Glue Tricks

| | Comments (0)

I keep all my music in lossless format (unless acquired compressed, such as through iTunes Music Store), so I am guaranteed it will sound perfect on my home systems, and so if I ever want to re-encode, I have the originals: no need to re-rip.

I have a pair of Perl scripts that convert those lossless files to 128 kbps AAC for use on the iPods. The first script will mount the drive of the iPod computer over the network, and compress any lossless file (using Mac::Glue/iTunes) that does not exist on the remote drive, or if it does exist, if it was last modified since the modification date of the lossless file. It will also straight copy any non-lossless file, and then write out text file representations of my playlists.

On the remote computer, the original computer's drive is mounted, and the first thing it does is look to make sure that every file in its directories exists on the original drive. If not, it deletes the file. Then it goes through iTunes (again, with Mac::Glue) and removes any library tracks whose file is missing from the filesystem. Then it adds any files from the filesystem missing in the library, and finally, recreates the playlists.

So last weekend I ran the first program, then the second. I came back to find the entire iPod library gone. What had happened is that the mount failed somehow, but the directory for it was there, so it was looking for the original files in an empty directory, and deleting files that didn't match, which was all of them.


So now I am recreating the whole library, which is a simple -- but very slow -- matter of re-running the first program, then the second. I estimate it will take about 3-4 days, running nonstop (it's a G4/867 doing the main encoding job), for about 8500 files, with maybe 6000 or so of those needing encoding.

Of course, I patched the second program to make sure that the mount point really is there. A simple matter of looking for the existence of a directory or file that will absolutely be there if the mount is correct, and will not be created by the program -- so should not exist -- if it is not.

I run the first program again. Everything is basically fine ... until my local hard drive fills up.

Same problem again, on the other side: the mount failed, and so it is copying files TO the wrong place: the local drive.

At least I didn't lose much time: I move those files out of the way, mount the remote drive, and copy them into place. Then I patch the second program in the same basic way, and run it again.

Hopefully it all works this time. I've run these programs many times over the last few years, and then two failures of the same type on different machines in the same week. Weird. use.perl.org

Leave a comment

<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Entry

This page contains a single entry by pudge published on February 28, 2008 1:29 PM.

Senator Haugen Blows Off U.S. 2, Too was the previous entry in this site.

Snohomish County To Hire "Inclusion Manager" is the next entry in this site.

Find recent content on the main index or look in the archives to find all content.