PDA

View Full Version : Subject: iTunesUpdateWin.pl



Dave Rodger
2004-12-13, 17:55
James--

> Date: Mon, 13 Dec 2004 09:21:29 -0000
> From: "Craig, James (IT)" <James.Craig (AT) morganstanley (DOT) com>
> To: "Slim Devices Discussion" <discuss (AT) lists (DOT) slimdevices.com>
> Subject: [slim] iTunesUpdateWin.pl
> Message-ID: <530CF4BB0B02E645BB0B25B944923A0F2C6651 (AT) LNWEXMB12 (DOT) msad.ms.com>
> Hello Dave,
> my script is not clever enough to figure out the relationship between
> your two drives because the leading directory is different between the
> two machines
> eg. \Spirit and \mp3.=20
> =20
> I have not had any bright ideas yet about how to make this automatic so
> I would suggest you hack the script to change the path by inserting this
> around line 150:
> $searchTerms{location} =3D~ s/^\\home/\\Spirit/;
>

I'm sure that's it, but my perl isn't good enough to figure out why that's
not exactly it.
Here's my debugging work-in-progress:
iTunesUpdateMsg( "Location is now *$searchTerms{location}*\n");

# reverse the slashes in case SlimServer is running on UNIX

$searchTerms{location} =~ s/\//\\/g;

iTunesUpdateMsg( "Location is now *$searchTerms{location}*\n");

#replace \\ with \ - not consistent within iTunes (not in my library at
least)

$searchTerms{location} =~ s/\\\\/\\/;

iTunesUpdateMsg( "Location is now *$searchTerms{location}*\n");

$searchTerms{location} =~ s/^\\host/\\Spirit/;

iTunesUpdateMsg( "Location is now *$searchTerms{location}*\n");

And here's some sample output:

Location is now */home/mp3/Ella Fitzgerald/Ella Wishes You a Swinging
Christmas/
04 What Are You Doing New Year's Eve.mp3*
Location is now *\home\mp3\Ella Fitzgerald\Ella Wishes You a Swinging
Christmas\
04 What Are You Doing New Year's Eve.mp3*
Location is now *\home\mp3\Ella Fitzgerald\Ella Wishes You a Swinging
Christmas\
04 What Are You Doing New Year's Eve.mp3*
Location is now *\home\mp3\Ella Fitzgerald\Ella Wishes You a Swinging
Christmas\
04 What Are You Doing New Year's Eve.mp3*
Searching iTunes for *Ella Fitzgerald What Are You Doing New Year's Eve?*
Found 2 track(s) in iTunes
Checking for: *\home\mp3\Ella Fitzgerald\Ella Wishes You a Swinging
Christmas\04
What Are You Doing New Year's Eve.mp3*
1 - False match: *\Spirit\itunes\Ella Fitzgerald\Ella Wishes You a Swinging
Chri
stmas\What Are You Doing New Year's Eve_.m4p*
2 - False match: *\Spirit\mp3\Ella Fitzgerald\Ella Wishes You a Swinging
Christm
as\04 What Are You Doing New Year's Eve.mp3*
Track not found in iTunes



So the first line is the raw source for location--

Then we switch from / to \

Then we remove any \\ and replace with \ (don't appear to be any in my list)

Then I want to replace \home\ with \Spirit\--

this is the Perl line:

$searchTerms{location} =~ s/^\\host/\\Spirit/;

Do I want that to be:

$searchTerms{location} =~ s/^\host^\/^\Spirit^\/;

(Trying, trying; that isn't it...)

Any thoughts?

Thanks!



-dave