Skip to content

Instantly share code, notes, and snippets.

@iolloyd
Created September 2, 2012 20:09
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save iolloyd/3604106 to your computer and use it in GitHub Desktop.
Save iolloyd/3604106 to your computer and use it in GitHub Desktop.
Use Audio Hijack Pro to record Spotify tracks while you listen
* Script to record and tag spotify tracks, by Lloyd Moore *)
(* Make sure you are already recording in Audio Hijack Pro with a session called 'spotifySession' *)
tell application "Spotify"
set currentTrack to (current track)
set trackName to (name of currentTrack)
tell application "Audio Hijack Pro"
set theSession to my getSession()
end tell
repeat
if trackName is not equal to (name of currentTrack) then
set trackName to name of current track
set trackArtist to artist of current track
my recordTrack(theSession, trackName, trackArtist)
end if
delay 1
end repeat
end tell
on recordTrack(theSession, trackName, trackArtist)
tell application "Audio Hijack Pro"
tell theSession
split recording
set output folder to "~/Desktop"
set output name format to "%tag_title -- %tag_artist"
set title tag to trackName
set artist tag to trackArtist
end tell
end tell
end recordTrack
on getSession()
tell application "Audio Hijack Pro"
set sessionName to "spotifySession"
try
set theSession to (first item of (every session whose name is sessionName))
theSession is not null
on error
set theSession to (make new application session at end of sessions)
set name of theSession to sessionName
end try
end tell
return theSession
end getSession
@balboah
Copy link

balboah commented Sep 6, 2013

@tiffanygwilson
Copy link

I know this thread is a little old now, but I was still having problems with the file splitting and tagging properly (even with balboah's update). I cobbled together a few similar scripts to get one that works for me; see my fork of this gist (https://gist.github.com/tiffanygwilson/1914c3b7724e65d736f6). I also added some automation for starting/stopping Spotify and the recording session and the option to select the output folder upon running the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment