First, thanks a lot to the community here. It’s been a very helpful resource for AppleScript questions.
I’m trying to simply duplicate an iTunes playlist but my scripts are taking waaay too much time to complete.
Something as simple as this runs for a minute:
tell application "iTunes" duplicate every track of playlist "playlist1" to playlist "playlist2" end tell
Do you know if there’s an alternative that runs faster than this?
My source playlist has 20,000 tracks, that sit on a separate “server” machine. All are indexed though.
Using iTunes’ UI, if I select them all then right click > “add to playlist […]” then that too takes ages. However, if I select the tracks then go to “File”>“New”>“Playlist from Selection”, that’s instantaneous. And why wouldn’t it? I’m not asking iTunes to duplicate the actual files, just the track references.
And btw, I’ve simplified the code to go to the essence of the issue, but my actual objective is to not just copy all tracks, but only the ones that match a criterion.
tell application "iTunes" duplicate (every track of playlist "playlist1" whose bpm is greater than 120 and bpm is less than 150) to playlist "playlist2" end tell
From my testing it is clear that it is not the “bpm” condition that slows everything down, it’s the actual duplicate function.
Appreciate any help! This is the last problem I need to solve to bring to its conclusion a very cool project I’ve spent a couple of weeks on: generate playlists on the fly based on “mood” scores (happy, sad, danceable, bright timbre etc.), calculated in real time based on the inputs from a physical midi controller.
Model: MacBook Air
Browser: Safari 537.36
Operating System: Mac OS X (10.12.6 beta 6)