trying to avoid duplicate entries via location..

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

deeg

New member
Joined
Jul 1, 2003
Messages
394
Points
0
Location
Swampland, UK
i have noticed that sometimes i can get duplicate library enteries when "adding" tracks from machine to machine.. in an attempt to prevent this i am reading the xml file to check if the location is already known to itunes and then trying to do...

duplicate (every track of library playlist 1 whose location is new_path) to playlist playlist_name

where new_path is an alias to the file i am copying, but this fails with a descriptor type mis-match

(if the location is not in the xml file then i just do an "add" and everything is fine.. reading the xml file is faster than doing a library search for large libraries)..

any ideas...

tia
 
Joined
Jul 1, 2003
Messages
705
Points
0
Location
Providence, RI, USA
Website
dougscripts.com
Filter probably won't work

You may have to do a repeat loop and compare locations. I don't know if a "whose" or "where" filter can compare location like that.

Other thought: coerce locations to strings. That might be the descriptor mismatch (alias ≠ string).
 

deeg

New member
Joined
Jul 1, 2003
Messages
394
Points
0
Location
Swampland, UK
hope not...

morning doug,

yeah, had already tried a compare track by track until location's matched and when found do a "duplicate atrack to playlist" type of thing.. only problem was that for 7600 tracks it took 40 minutes to import 3 tracks.. might be able to cut that down by building a list of locations and then do a

repeat with atrack in library playlist 1
if {list of locations} contains location of atrack then
duplicate atrack to playlist x
end if
end repeat

type of thing but its still going to be 20 minutes + (roughly)..

by reading the xml file and then doing an "offset of location in xmlfile" type of check its down to seconds per imported track inorder to find the known ones..

will try the coercing..

Deeg
 
Joined
Jul 1, 2003
Messages
705
Points
0
Location
Providence, RI, USA
Website
dougscripts.com
This looks like a job for...

Hey deeg,

Yes, of course, I should have known you'd gone about it the way you did. :)

As I've probably mentioned to you before and as I never tire of saying: Bery Rinaldo has a neat Perl/AppleScript combo that parses the XML file. It's part of his Export Playlist to M3U download. I think his Perl engine could be modified to retrieve any data from the XML (without that osax thing that we were all playing with a few months ago--recall?). What's also interesting is how he uses AppleScript and the Perl script together. You just don't see a lot of functional examples of that. Perl is incredibly FAST when working with text.

I have been meaning to do some work with his Perl script for quite some time and just plain haven't gotten around to it.
 

deeg

New member
Joined
Jul 1, 2003
Messages
394
Points
0
Location
Swampland, UK
Re: This looks like a job for...

Doug Adams said:
Yes, of course, I should have known you'd gone about it the way you did. :)
well there's more than one method of de-furring a furry animal :)

thats not a bad idea.. might be able to do a

"duplicate (every track whose database id is an_id) to playlist x"

if i use berry's method to parse the file and back track from the location to the track id...sneaky :D

thanks for the suggestion...

also... been thinking...something along lines of...

repeat with atrack in library playlist 1
if {list of locations} contains location of atrack then
duplicate atrack to playlist x
set acounter to acounter + 1
if acounter = count of items of {list of locations} then exit repeat
end if
end repeat

would be quicker since when we have found all the tracks then we don't need to check anymore...
 
Last edited:
Joined
Jul 1, 2003
Messages
705
Points
0
Location
Providence, RI, USA
Website
dougscripts.com
I think you've got the right idea with Bery's parsing thing! Go for it, I'm anxious to hear about speed increase, if any.

repeat with atrack in library playlist 1
if {list of locations} contains location of atrack then
duplicate atrack to playlist x
set acounter to acounter + 1
if acounter = count of items of {list of locations} then exit repeat
end if
end repeat

would be quicker since when we have found all the tracks then we don't need to check anymore...
Yeah, that's good.
 
Top