Following a discussion on Twitter a few weeks ago, Jeff Porten shared with me an AppleScript he uses to listen to podcasts on his Mac at faster or slower speed. The script lets you choose a playlist, then choose whether you want to listen at 75% or 150% of the normal speed. It then opens the podcasts in QuickTime Player and plays them.
It's a nifty script, and if you like to speed up podcasts on your Mac, as you may do on an iOS device, this makes it easier to do so. It's a bit more sophisticated than the script in this hint from 2006, as it can keep going through a playlist.
It's a nifty script, and if you like to speed up podcasts on your Mac, as you may do on an iOS device, this makes it easier to do so. It's a bit more sophisticated than the script in this hint from 2006, as it can keep going through a playlist.
(*
iTunes FastPodcast 1.2, by Jeff Porten
jporten@gmail.com
Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0)
http://creativecommons.org/licenses/by-nc/3.0/
*)
tell application "iTunes"
set setupNeeded to false
--fetch prior selected playlist name and playback rate
try
set targetPlaylistName to do shell script "defaults read com.jeffporten.fastpodcast SelectedPlaylist"
set playbackRate to do shell script "defaults read com.jeffporten.fastpodcast PlaybackRate"
on error -- probably first run of script
set setupNeeded to true
end try
if setupNeeded is false then -- confirm using last settings
set userReply to button returned of (display dialog "Play playlist \"" & targetPlaylistName & "\" at " & playbackRate & " speed?" buttons {"Cancel", "Change...", "OK"} default button "OK")
if userReply is "Change..." then set setupNeeded to true
end if
if setupNeeded is true then -- set up new settings
set listPlaylists to the name of every playlist
set targetPlaylistName to (choose from list listPlaylists with prompt "Which playlist to play?" without multiple selections allowed and empty selection allowed) as text
set selectedSpeed to button returned of (display dialog "Playback rate to use?" & return & return & "(½X and 2X correspond to iPod playback speeds, actually 75% and 150%)" buttons {"Custom", "½X", "2X"})
if selectedSpeed is "2X" then
set playbackRate to 1.5
else if selectedSpeed is "½X" then
set playbackRate to 0.75
else
set playbackRate to text returned of (display dialog "Enter a playback speed. (1.0 is normal speed, 2.0 is true double-speed, 0.5 is true half-speed.)" default answer "1.0")
end if
end if
--store settings in a non-AppleScripty way
do shell script "defaults write com.jeffporten.fastpodcast SelectedPlaylist " & (quoted form of targetPlaylistName)
do shell script "defaults write com.jeffporten.fastpodcast PlaybackRate " & (quoted form of (playbackRate as text))
--actually do the playback in QuickTime Player
set targetPlaylist to playlist targetPlaylistName
set trackList to tracks of targetPlaylist
repeat with i from 1 to count trackList
set thisTrack to item i of trackList
set podcastName to album of thisTrack
set thisLoc to location of thisTrack
set thisDuration to duration of thisTrack
tell application "QuickTime Player"
activate
open thisLoc
play document 1
set rate of document 1 to playbackRate
--if some podcasts should never be rate-altered, delete last line and use this instead
--if (podcastName does not contain "Onion") then set rate of document 1 to 1.5
--or for multiple podcasts, add as many of these as you like before "then set rate":
--and (podcastName does not contain "someOtherPodcast")
set nextTrack to false
set j to 0
--if the QTP player is manually ended by dragging the slider to the end, automatically starts next podcast
--if QTP player is closed, script errors out of existence
--otherwise, when playback is finished, script will close the QuickTime Player document and open the next track in the playlist
repeat until nextTrack is true
delay 2
if current time of document 1 ≥ duration of document 1 then set nextTrack to true
end repeat
close document 1
end tell
--mark the track as played
set played count of thisTrack to (played count of thisTrack) + 1
--I use this AppleScript line to set the rating of the podcast track to one star, which I delete later from a smart playlist
--set rating of thisTrack to 20
end repeat
end tell
•
[3,393 views]

