• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iTunes scripting - comparing playlists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iTunes scripting - comparing playlists


  • Subject: Re: iTunes scripting - comparing playlists
  • From: Mr Tea <email@hidden>
  • Date: Mon, 16 Feb 2004 13:26:11 +0000

On 16 Feb 2004, at 8.33 am, Stephen Schaefer wrote:

I have 5 smart playlists in iTunes that contain songs that have played each of the last 5 days separately (i.e., Last played is not in the last 2 days, Last Played is in the 3 days, etc). I want to compare the tracks in each of these playlists: specifically, I'd like to set up an expression that finds tracks that appear in 2 or more of the 5 playlists. For example, the script would look all the tracks in the first list and see if any are also in one or more of the other four playlists. Then it would check the second playlist and see if any of the tracks were in one more or more of list three, four, or five, and on down the line.

Hi, Stephen.

Here's a script that will find any tracks that appear more than once in a specified list of playlists. Hope it does what you need.

--===========================================================
tell application "iTunes"
activate
set d1 to database ID of every track of playlist "Last 1 Day"
set d2 to database ID of every track of playlist "Last 2 Days"
set d3 to database ID of every track of playlist "Last 3 Days"
set d4 to database ID of every track of playlist "Last 4 Days"
set d5 to database ID of every track of playlist "Last 5 Days"
end tell

set dList to d1 & d2 & d3 & d4 & d5
set mostPlayed to {}
repeat ((count dList) - 1) times
set thisID to item 1 of dList
if thisID is in rest of dList then set end of mostPlayed to thisID
set dList to rest of dList
end repeat

tell application "iTunes"
repeat with trk in (every track of masterList)
if database ID of trk is in mostPlayed then set rating of trk to 100
end repeat
end tell
--===========================================================

(Any lines that abut the left margin of the message window have been wrapped and should be re-connected to the end of the previous line.)


The last part of the script (inside the second iTunes tell block) is a tad sluggish. More knowledgeable scripters may know how to speed this up...


Nick
pp Mr Tea
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >iTunes scripting - comparing playlists (From: Stephen Schaefer <email@hidden>)

  • Prev by Date: Re: addendum to iTunes scripting
  • Next by Date: Re: New complements for Smile: askpassword, playsound, Spell checker.
  • Previous by thread: iTunes scripting - comparing playlists
  • Next by thread: addendum to iTunes scripting
  • Index(es):
    • Date
    • Thread