Re: Duplicates files in iTunes after running applescript
Re: Duplicates files in iTunes after running applescript
- Subject: Re: Duplicates files in iTunes after running applescript
- From: Axel Luttgens <email@hidden>
- Date: Wed, 31 Dec 2008 15:13:55 +0100
Le 31 déc. 08 à 12:33, Paul Taylor a écrit :
Hi, I have created some applescript, that creates a playlist of all
the files I have modified outside of iTunes, part of the reason for
doing this is that iTunes then has updated metadata information for
these files without having to select 'Get Info' within iTunes. The
trouble is that for some reason some (but not most) of the files now
appear in iTunes twice both referring to the exactly same physical
file.
Can anybody see what is going wrong
The problem might be with the use of the "add" command, as it somehow
behaves like a kind of import command.
So, even if the file being added already is in your "iTunes Music"
folder, iTunes may decide that it needs to create an additional track
for that file.
I don't know which criterions are taken into account by iTunes; but
the behavior should also depend on some settings in iTunes' preferences.
thanks Paul
example applescript
tell app "iTunes"
set new_playlist to (make user playlist with properties
{name:"newList12/20/08 4:01 PM"})
add(POSIX file "/Users/renaudg/Music/iTunes/iTunes Music/Astral
Projection/Another World/09 Still on mars.mp3") to new_playlist
add(POSIX file "/Users/renaudg/Music/iTunes/iTunes Music/U2/October/
03 I Threw A Brick Through A Window.mp3") to new_playlist
add(POSIX file "/Users/renaudg/Music/iTunes/iTunes Music/Emilie
Simon/Emilie Simon (bonus disc)/01 Desert (english version).mp3") to
new_playlist
repeat with nexttrack in (get every track of new_playlist)
refresh nexttrack
end repeat
end tell
The safe way would be to refresh the existing tracks, the ones whose
files already are in the "iTunes Music" folder.
Unfortunately, I couldn't devise a valid whose clause based on the
location property of file tracks.
So, here's the slow way:
set L to {"/Users/renaudg/Music/iTunes/iTunes Music/Astral Projection/
Another World/09 Still on mars.mp3","/Users/renaudg/Music/iTunes/
iTunes Music/U2/October/03 I Threw A Brick Through A Window.mp3","/
Users/renaudg/Music/iTunes/iTunes Music/Emilie Simon/Emilie Simon
(bonus disc)/01 Desert (english version).mp3"}
tell application "iTunes"
repeat with T in file tracks
if POSIX path of (get location of T) is in L then
refresh T
end if
end repeat
end tell
But I'm not really well versed in scripting iTunes...
Within the iTune sMusic folder it shows Still on Mars twice (wrong)
but it only shows 'I Threw A Brick Through A Window.' once
(correct), this is reflected in the iTunes xml file
[...]
Perhaps would it be interesting to have a look further in the xml
file, so as to know which playlists contain tracks with ID 5779 and
41012.
HTH,
Axel _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden