--copyleft 2006 LEPING ZHA [http://www.lepingzha.com]
--this module is covered by the GNU LIMITED GENERAL PUBLIC LICENSE  NO
WARRANTY
--Do not remove this notice

tell application "iTunes"
        activate
        
        repeat with i from 1 to the count of sources
                if the kind of source i is audio CD then
                        set theCD to the audio CD playlist 1 of source i
                end if
        end repeat
        
        if selection exists then
                set trackList to (get a reference to (selection of front 
window))
                set trLister to make new playlist with properties
{name:"*songProps"}
                duplicate trackList to trLister
        else
                display dialog "You must select the tracks you wish to copy the 
CD
information to."
        end if
        
        repeat with n from 1 to the count of audio CD tracks in theCD
                set cdTr to the track number of audio CD track i of theCD
                if cdTr is not i then
                        delete trLister
                        display dialog "Stop this script and sort your CD 
tracks by track
number" buttons {"Cancel"}
                else
                        -- do nothing
                end if
        end repeat
        
        repeat with i from 1 to the count of tracks in trLister
                set the track number of track i of trLister to i as integer
        end repeat
        
        repeat with i from 1 to the count of audio CD tracks in theCD
                set trackFlag to true
                set trackNum to 1
                set trackCount to the (count of tracks in trLister) as integer
                
                repeat while trackFlag is true
                        
                        if trackNum is not equal to trackCount then
                                set trNum to the track number of track trackNum 
of trLister as
integer
                                
                                if trNum is i then
                                        set the artist of (track trackNum of 
trLister) to (the artist of
audio CD track i of theCD) as string
                                        set the album of (track trackNum of 
trLister) to (the album of
audio CD track i of theCD) as string
                                        set bpm of (track trackNum of trLister) 
to (bpm of audio CD track
i of theCD) as integer
                                        set comment of (track trackNum of 
trLister) to (comment of audio
CD track i of theCD) as text
                                        set compilation of (track trackNum of 
trLister) to (compilation of
audio CD track i of theCD) as boolean
                                        set the composer of (track trackNum of 
trLister) to (the composer
of audio CD track i of theCD) as string
                                        set the disc number of (track trackNum 
of trLister) to (the disc
number of audio CD track i of theCD) as integer
                                        set the disc count of (track trackNum 
of trLister) to (the disc
count of audio CD track i of theCD) as integer
                                        set enabled of (track trackNum of 
trLister) to (enabled of audio
CD track i of theCD) as boolean
                                        set EQ of (track trackNum of trLister) 
to (EQ of audio CD track i
of theCD) as text
                                        set finish of (track trackNum of 
trLister) to (finish of audio CD
track i of theCD) as integer
                                        set genre of (track trackNum of 
trLister) to (genre of audio CD
track i of theCD) as text
                                        set the name of (track trackNum of 
trLister) to (the name of audio
CD track i of theCD) as string
                                        set rating of (track trackNum of 
trLister) to (rating of audio CD
track i of theCD) as integer
                                        set start of (track trackNum of 
trLister) to (start of audio CD
track i of theCD) as integer
                                        try
                                                set track count of (track 
trackNum of trLister) to (track count
of audio CD track i of theCD) as integer
                                                set track number of (track 
trackNum of trLister) to (track number
of audio CD track i of theCD) as integer
                                        end try
                                        set year of (track trackNum of 
trLister) to (year of audio CD
track i of theCD) as integer
                                        set trackFlag to false
                                else
                                        set trackNum to trackNum + 1
                                end if
                                
                        else
                                set trNum to the track number of track trackNum 
of trLister as
integer
                                
                                if trNum is i then
                                        set the artist of (track trackNum of 
trLister) to (the artist of
audio CD track i of theCD) as string
                                        set the album of (track trackNum of 
trLister) to (the album of
audio CD track i of theCD) as string
                                        set bpm of (track trackNum of trLister) 
to (bpm of audio CD track
i of theCD) as integer
                                        set comment of (track trackNum of 
trLister) to (comment of audio
CD track i of theCD) as text
                                        set compilation of (track trackNum of 
trLister) to (compilation of
audio CD track i of theCD) as boolean
                                        set the composer of (track trackNum of 
trLister) to (the composer
of audio CD track i of theCD) as string
                                        set the disc number of (track trackNum 
of trLister) to (the disc
number of audio CD track i of theCD) as integer
                                        set the disc count of (track trackNum 
of trLister) to (the disc
count of audio CD track i of theCD) as integer
                                        set enabled of (track trackNum of 
trLister) to (enabled of audio
CD track i of theCD) as boolean
                                        set EQ of (track trackNum of trLister) 
to (EQ of audio CD track i
of theCD) as text
                                        set finish of (track trackNum of 
trLister) to (finish of audio CD
track i of theCD) as integer
                                        set genre of (track trackNum of 
trLister) to (genre of audio CD
track i of theCD) as text
                                        set the name of (track trackNum of 
trLister) to (the name of audio
CD track i of theCD) as string
                                        set rating of (track trackNum of 
trLister) to (rating of audio CD
track i of theCD) as integer
                                        set start of (track trackNum of 
trLister) to (start of audio CD
track i of theCD) as integer
                                        try
                                                set (track count of track 
trackNum of trLister) to track count of
(audio CD track i of theCD) as integer
                                                set (track number of track 
trackNum of trLister) to track number
of (audio CD track i of theCD) as integer
                                        end try
                                        set year of (track trackNum of 
trLister) to (year of audio CD
track i of theCD) as integer
                                        set trackFlag to false
                                else
                                        set enabled of audio CD track i of 
theCD to false
                                        set trackFlag to false
                                end if
                                
                        end if
                end repeat
        end repeat
        
        repeat with i from 1 to the (count of tracks in trLister)
                set enabled of (track i of trLister) to true
        end repeat
        
        delete trLister
end tell


-- 
leping
------------------------------------------------------------------------
leping's Profile: http://forums.slimdevices.com/member.php?userid=6477
View this thread: http://forums.slimdevices.com/showthread.php?t=25333

_______________________________________________
ripping mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/ripping

Reply via email to