Faster way to delete tracks? - iLounge Forums
Become a member of the iLounge Forums. Register Now!
To start viewing messages, select the forum that you want to visit from the selection below.
If this is your first visit, be sure to check out the Forum FAQ and Forum Policy.

Topic: Faster way to delete tracks?

Reply Thread Tools Topic Search
 
Old 01-06-2006, 02:25 AM
#1
 
Freshman Lounger
 
Join Date: Jan 2006
Location: Maryland
Posts: 1
Question Faster way to delete tracks?

I am learning AppleScript, and as a consequence, stealing other people's snippets of code and modifying it to accomplish what I want. Which means while I have a general understanding of how things work, I don't have an in depth understanding (yet). This script is, in fact, my very first AppleScript (at least since System 7; it's been a long time since I used it ).

In looking over the forums, I have seen a couple of mentions of things along this topic, but I didn't see an answer to my specific question. I have the code:

###############################

with timeout of 600 seconds

tell application "iTunes"

if selection is not {} then

set sel to selection
set oldfi to fixed indexing
set fixed indexing to true

repeat with aTrack in sel
if (class of aTrack) is file track then

set floc to (get location of aTrack)
-- set dbloc to database ID of aTrack

convert aTrack
delete (some file track of library playlist 1 whose database ID is (get database ID of aTrack))
tell application "Finder" to delete floc
end if
end repeat
set fixed indexing to oldfi
else
display dialog "No tracks selected." buttons {"Cancel"}
end if
end tell

end timeout

###############################

This script functions perfectly (there's no real error checking, but it works in general), but the delete line can take 30 or so seconds per track to complete. In other words, it's taking longer to delete the reference to the file than it is to convert it in most cases.

Is there a faster way to delete a track from the main list?

I specifically do NOT want to have to create a playlist and work from it. I'm trying to make this as "smart" as possible, so I can just hilight tracks and convert then remove them (both from iTunes, and from the disk). I have accomplished that, but the speed is... ludicrously slow.

Any suggestions on making the delete faster would be appreciated, if it's possible to do so.
tknmncr is offline  
Reply With Quote
Old 01-10-2006, 03:32 AM
#2
 
Senior Lounger
 
Join Date: Jun 2005
Posts: 244

the problem is this syntax:

delete (some file track of library playlist 1 whose database ID is (get database ID of aTrack))

instead use the "search" command. techniques for doing this have been covered in other threads. see for example:

http://forums.ipodlounge.com/showthr...light=playlist

Last edited by WoodenBrain; 01-10-2006 at 03:35 AM.
WoodenBrain is offline  
Reply With Quote

Topic: Faster way to delete tracks?

Reply Thread Tools Topic Search

Become a member of the iLounge Forums. Register Now!
To start viewing messages, select the forum that you want to visit from the selection below.
If this is your first visit, be sure to check out the Forum FAQ and Forum Policy.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



RSS Feed Widget

iLounge Weekly
News, reviews, articles, giveaways, deals, and more delivered to your inbox.
Sign up for the iLounge Weekly Newsletter

iLounge is an independent resource for all things iPod, iPhone, iPad, and beyond.
iPod, iPhone, iPad, iTunes, Apple TV, Mac, and the Apple logo are trademarks of Apple Inc.
iLounge is © 2001 - 2016 iLounge, Inc. All Rights Reserved. Terms of Use | Privacy Policy