[OSX-Users] Re: downgrading sound quality?
Daniel Thorpe
dt05r at ecs.soton.ac.uk
Fri Sep 18 13:08:00 BST 2009
> The short answer is: there isn't.
Well, there's nothing that *can't* be done. It just might not be
pretty, or quick.
I've modified this script: http://dougscripts.com/itunes/scripts/ss.php?sp=riptoipod
so that it works with the tracks you've selected, although it seems
only for tracks you have stored locally. I haven't really got time to
look into why it doesn't work for music on a network volume, but maybe
someone else does.
If you copy this as is into Script Editor, select some tracks in
iTunes, have an iPod (I haven't tested it with an iPhone), and run the
script, then it will transcode the files from whatever they are to
whatever encoding setting you select, import them onto the iPod and
then remove the newly created files. It's just a bit slow as it does
each track one at a time.
You could also package it up into a service for a contextual menu in
iTunes using Automator...
Good luck!
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Start of script
property my_title : "Import To iPod"
property opt1 : "Change Encoder"
global this_iPod -- the selected iPod
global list_of_iPod_sources
global list_of_iPod_names
global importTheseTracks
global encoder_backup
check_for_iPod()
getSelectedTracks()
tell application "iTunes"
-- send to which iPod?
if (length of list_of_iPod_sources) > 1 then
set this_iPod_name to (choose from list list_of_iPod_names with
prompt "Select the iPod to use: " with title my_title without
multiple selections allowed and empty selection allowed) as text
if this_iPod_name is "false" then return
set this_iPod to some source whose name is this_iPod_name and kind
is iPod
else
set this_iPod to item 1 of list_of_iPod_sources
set this_iPod_name to item 1 of list_of_iPod_names
end if
-- get encoder info
set theEncoderNames to (get name of every encoder)
set n to (get name of current encoder)
repeat with j from 1 to (length of theEncoderNames)
if n is item j of theEncoderNames then
copy name of current encoder to encoder_backup
exit repeat
end if
end repeat
repeat
set conf_or_cont to button returned of (display dialog "Transcode
the enabled (check-marked) tracks, and import them to iPod via iTunes,
then removes the duplicated tracks from iTunes library and deletes the
files from your hard drive." & return & return & ("Current encoder: "
& (get name of current encoder)) buttons {"Cancel", opt1,
"Continue..."} default button 3 giving up after 300 with title my_title)
if conf_or_cont is opt1 then
-- change encoder
set myNewEncoder to (choose from list theEncoderNames with prompt
"Convert enabled tracks using..." default items ((get name of current
encoder) as list) OK button name "Select" cancel button name "Cancel"
with title my_title without multiple selections allowed and empty
selection allowed) as text
if myNewEncoder is "false" then return
set current encoder to encoder myNewEncoder
else
exit repeat
end if
end repeat
set addenda to ""
try
with timeout of 30000 seconds
repeat with aTrack in importTheseTracks
set new_import to item 1 of (convert aTrack)
if ((get free space of this_iPod) as real) < (size of new_import)
then
set addenda to (return & return & "There is not enough room on
the iPod to continue.")
my nuke_this_track(new_import)
exit repeat
end if
try
set n to (get new_import's name)
set x to (add (get new_import's location) to library playlist 1
of this_iPod)
set x's name to n
on error m number n
-- debugging
-- log m
-- log n
end try
my nuke_this_track(new_import)
end repeat
end timeout
on error m number n
log "ERROR: " & m
set current encoder to encoder encoder_backup
try
display dialog "Operation canceled." & return & return & m buttons
{"OK"} default button 0 with icon 2
end try
return
end try
set current encoder to encoder encoder_backup
if frontmost then
if gave up of (display dialog "Done." & return & return & "Current
encoder: " & encoder_backup & addenda buttons {"Thanks"} default
button 1 with title my_title giving up after 15) then return
end if
end tell
to nuke_this_track(t)
tell application "iTunes"
set loc to quoted form of POSIX path of ((get location of t) as text)
delete t
end tell
do shell script "rm " & loc
end nuke_this_track
to getSelectedTracks()
tell application "iTunes"
if selection is not {} then
set importTheseTracks to selection
else
display dialog return & "No tracks selected"
end if
end tell
end getSelectedTracks
to check_for_iPod()
set this_iPod to missing value
set list_of_iPod_sources to {}
set list_of_iPod_names to {}
tell application "iTunes"
set lp to every source whose kind is iPod
if lp is {} then return
repeat with src in lp
my check_ipod_management(src)
end repeat
end tell
if list_of_iPod_sources is {} then
display dialog return & "No manually managed iPods are mounted..."
buttons {"Cancel"} default button 1 with icon 0 giving up after 15
with title my_title
error number -128
end if
end check_for_iPod
to check_ipod_management(p)
tell application "iTunes"
try
set x to (make new user playlist at p)
delete x
set end of list_of_iPod_sources to p
set end of list_of_iPod_names to (name of p)
end try
end tell
end check_ipod_management
-- End of script
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Cheers
Dan
On 18 Sep 2009, at 12:35, Vladimiro Sassone wrote:
> On 18 Sep 2009, at 11:45, "Neil Broderick" <ngb at ecs.soton.ac.uk>
> wrote:
>
>> Clearly there is the time consuming solution of importing everything
>> twice which I would like to avoid. But if there is a simpler
>> solution that somebody can tell me would be great.
>
> The short answer is: there isn't.
>
> A more elaborate answer is that if you use ffmpeg to transcode from
> ALAC to AAC or to MP3 you'll definitely gain loads both in quality
> (wrt the crappy Apple importer) and speed (apart that ffmpeg is fast,
> you won't have to spin a cd).
>
More information about the Osx-users
mailing list