A TEMPORARY SOLUTION
Faced with the dilemma of having an iCloud-ready version of iTunes (10.4 and above) or a Front Row-compatible version of iTunes (10.3.1) running on Lion, and while we await for a definitive solution brought by Apple, there are things we can do to have the best of both worlds running on Lion through some Applescript code. I've quickly put together the code presented below, which can still be greatly improved upon. Although it is offered with no guarantees, it should work well in most situations. For it to work properly, several requirements must be met:
- The script is intended to run on Lion. It's unnecessary in Snow Leopard and it won't work in anything below Lion.
- iTunes 10.4 must be installed.
- A copy of the iTunes 10.3.1 application (i.e., not the framework or any other componentes) must ALSO be in the /Applications folder with the name "iTunes 10.3.1". If you already have iTunes (10.4) in place, simply copy a backup copy of the previous iTunes. Remember to rename it as "iTunes 10.3.1".
- A copy of the old-style iTunes Library (iTunes Library.itl) must exist in ~/Music/iTunes with the name "old-style iTunes Library.itl". You can get it from ~/Music/iTunes/Previous iTunes Libraries.
- A copy of the new-style iTunes Library (iTunes Library.itl if you have run iTunes 10.4) must exist in ~/Music/iTunes with the name "new-style iTunes Library.itl".
- Front Row must have been reinstalled. Ralph Perdomo created a package to achieve this on Lion.
If all six requirements are met, the following script (name it anything you like and place it wherever it suits you) will see to it that your iTunes Library is, at all times, ready to do what you want it to do, effecting EITHER (future) iCloud-compatibility OR Front Row-compatibility. Notice that this doesn't involve any hacks of any kind. When you swap from iCloud-compatibility to Front Row-compatibility, and vice versa, the script makes some noise (it sends temporary files to the trash). A revamped version of the script might avoid this noise in future. The script even allows you to launch Front Row from it if you've just used it to make your iTunes Library Front Row-compatible.
Here's the script:
#Make sure any instances of iTunes (10.3.1 or above) is closed
set iTunesVersion to "iTunes"
tell applicationiTunesVersion
quit
end tell
#Establish common dialog title
set dialogTitle to "iTunes integration with Front Row/iCloud on Lion"
#Check that Lion is running
set osVersion to do shell script "sw_vers -productVersion"
if osVersion < "10.7" then
display dialog "This is not intended for versions below OS X 10.7 Lion" buttons {"OK"} with title dialogTitle with icon stop
return
end if
#Check that iTunes 10.4 or above is installed
set iTunesMainVersion to ""
tell applicationiTunesVersion
set iTunesMainVersion to version
end tell
if iTunesMainVersion < "10.4" then
display dialog "This can only run if your regular version of iTunes is 10.4 or above" buttons {"OK"} with title dialogTitle with icon stop
return
end if
#Check that iTunes 10.3.1 is also installed
try
set iTunesFrontRowVersion to (path to applications folder as text) & "iTunes 10.3.1.app" as alias
on error number -43
display dialog "This can only run if, in addition to iTunes 10.4 or above, you have iTunes 10.3.1 in your Applications folder" buttons {"OK"} with title dialogTitle with icon stop
return
end try
#Check that old-style iTunes Library.itl exists
set oldStyle_iTunesLibrary to ""
try
set oldStyle_iTunesLibrary to (path to home folder as text) & "Music:iTunes:old-style iTunes Library.itl" as alias
on error number -43
display dialog "old-style iTunes Library.itl does not exist in" & (path to home folder as text) & "Music:iTunes:" buttons {"OK"} with title dialogTitle with icon stop
return
end try
#Check that new-style iTunes Library.itl exists
set newStyle_iTunesLibrary to ""
try
set newStyle_iTunesLibrary to (path to home folder as text) & "Music:iTunes:new-style iTunes Library.itl" as alias
on error number -43
display dialog "new-style iTunes Library.itl does not exist in" & (path to home folder as text) & "Music:iTunes:" buttons {"OK"} with title dialogTitle with icon stop
return
end try
#Make sure iTunes 10.4 or above is closed
tell applicationiTunesVersion
quit
end tell
#Make sure iTunes 10.3.1 is closed
set iTunesVersion to "iTunes 10.3.1"
tell applicationiTunesVersion
quit
end tell
#Check that Front Row is installed
try
set iTunesFrontRowVersion to (path to applications folder as text) & "Front Row.app" as alias
on error number -43
display dialog "This can only run if you have installed Front Row" buttons {"OK"} with title dialogTitle with icon stop
return
end try
#Establish version of current iTunes Library.itl
set currentItlLibrary to (path to home folder as text) & "Music:iTunes:iTunes Library.itl" as alias
set currentItlLibraryVersion to (read (currentItlLibrary) from 18 to 23 asstring)
#Prompt the user as to their choices
set message to "The current version of iTunes Library.itl is " & currentItlLibraryVersion & ", which is compatible with "
if currentItlLibraryVersion < "10.4" then
set message to message & "Front Row.
Do you want to make it iCloud-compatible instead?"
else
set message to message & "iCloud.
Do you want to make it Front Row-compatible instead?"
end if
set question to display dialogmessagebuttons {"Yes", "No"} default button 2 with titledialogTitlewith icon 2
set answer to button returned of question
#If the user decides not to change the format, quit
if answer = "No" then
return
end if
if currentItlLibraryVersion < "10.4" then
#Copy iTunes Library.itl to old-style iTunes Library.itl
tell application "Finder" to duplicatefilecurrentItlLibrary
tell application "Finder" to deletefileoldStyle_iTunesLibrary
set temporary_iTunesLibrary to (path to home folder as text) & "Music:iTunes:iTunes Library copy.itl" as alias
tell application "Finder" to set name of file temporary_iTunesLibrary to "old-style iTunes Library.itl"
#Copy new-style iTunes Library.itl to iTunes Library.itl
tell application "Finder" to duplicatefilenewStyle_iTunesLibrary
tell application "Finder" to delete file currentItlLibrary
set temporary_iTunesLibrary to (path to home folder as text) & "Music:iTunes:new-style iTunes Library copy.itl" as alias
tell application "Finder" to set name of file temporary_iTunesLibrary to "iTunes Library.itl"
#Launch newer version of iTunes so that it will update the library, if necessary
# do shell script "/Applications/iTunes.app/Contents/MacOS/iTunes -ProfileManager"
set iTunesVersion to "iTunes"
tell applicationiTunesVersion
launch
end tell
#Advise the user
display dialog "iTunes has been launched so that it will update its library with whatever purchases you may have made while running iTunes 10.3.1. You may quit iTunes whenever you are ready. Front Row integration has been suspended and iCloud integration restored." buttons {"OK"} with title dialogTitle with icon 2
else
#Copy iTunes Library.itl to new-style iTunes Library.itl
tell application "Finder" to duplicatefilecurrentItlLibrary
tell application "Finder" to deletefilenewStyle_iTunesLibrary
set temporary_iTunesLibrary to (path to home folder as text) & "Music:iTunes:iTunes Library copy.itl" as alias
tell application "Finder" to set name of file temporary_iTunesLibrary to "new-style iTunes Library.itl"
#Copy old-style iTunes Library.itl to iTunes Library.itl
tell application "Finder" to duplicatefileoldStyle_iTunesLibrary
tell application "Finder" to delete file currentItlLibrary
set temporary_iTunesLibrary to (path to home folder as text) & "Music:iTunes:old-style iTunes Library copy.itl" as alias
tell application "Finder" to set name of file temporary_iTunesLibrary to "iTunes Library.itl"
#Launch older version of iTunes so that it will update the library, if necessary
set iTunesVersion to "iTunes 10.3.1"
tell applicationiTunesVersion
launch
end tell
#Advise the user
set question to display dialog "iTunes 10.3.1 has been launched so that it will update its library with whatever purchases you may have made while running newer versions of iTunes. You may quit iTunes whenever you are ready. iCloud integration has been suspended and Front Row integration restored." buttons {"Close", "Close iTunes", "Launch Front Row"} default button 3 with title dialogTitle with icon 2
set answer to button returned of question
#If the user decides not to do anything, quit
if answer = "Close" then
return
end if
tell applicationiTunesVersion
quit
end tell
if answer = "Launch Front Row" then
tell application "System Events"
key code 53 usingcommand down
end tell
end if
end if
-------------------------------------------------------------
Enjoy!