Friday 30 October 2015

Record Spotify Tracks for Offline listening (OSX El Capitan)

Record Spotify Tracks for Offline listening.
I have attached the Apple Script below that seems to work for me.
I have tested it using Audio Hijack Pro v2.10.6 and latest version of Spotify on OSX El Capitan.


property update_delay : 1.0E-3
property output_folder : "~/Music/iTunes/iTunes Media/Automatically Add to iTunes.localized"

tell application "Audio Hijack Pro"
 activate
 -- Create a new session "Spotify" if it doesn't already exist
 try
  set spotify_session to first session whose name is "Spotify"
  if output name format of spotify_session is not "%tag_artist - %tag_title" then
   display dialog "The existing profile for \"Spotify\" does not utilize %tag_artist and %tag_title in the output name format option. Please add this if you want your files to be named automatically or delete/rename your existing \"Spotify\" session."
  end if
 on error number -1719
  tell application "Finder"
   set spotify_path to POSIX path of (application file id "spty" as alias)
  end tell
  set spotify_session to make new application session at end of sessions
  set targeted application of spotify_session to spotify_path
  set output folder of spotify_session to output_folder
  set output name format of spotify_session to "%tag_artist - %tag_title"
  set recording format of spotify_session to {encoding:MP3, bit rate:320, channels:Stereo, style:CBR}
 end try
 set name of spotify_session to "Spotify"
 
 -- (Re-)start hijacking and recording on the spotify session
 if hijacked of spotify_session is true then
  stop hijacking spotify_session
 end if
 start hijacking spotify_session relaunch yes
end tell

tell application "Spotify"
 if not running then activate
 if player state is playing then pause
 
 -- display dialog "Start playing the tracks that you want to rip with Audio Hijack, quit spotify when done."
 if repeating then display dialog "Please notice that you have repeating enabled in Spotify!"
 
 set has_started to false -- Whether spotify have been playing yet
 
 -- Check for changes to current track until spotify exits
 repeat until application "Spotify" is not running or (has_started is true and player state is not playing)
  -- Changed track
  try
   set current_id to id of current track
  on error number -1728
   set current_id to ""
  end try
  if has_started and current_id is not recording_id then
   tell application "Audio Hijack Pro" to stop recording spotify_session
   set has_started to false
  end if
  
  -- Started playing
  if has_started is not true and player state is playing then
   set has_started to true
   set recording_id to id of current track
   
   -- Get the metadata
   set track_name to name of current track
   set track_artist to artist of current track
   set track_album to album of current track
   set track_album_artist to album artist of current track
   set track_disc to disc number of current track
   set track_number to track number of current track
   set track_spotify to spotify url of current track
   
   tell application "Audio Hijack Pro"
    set title tag of spotify_session to track_name
    set artist tag of spotify_session to track_artist
    set album tag of spotify_session to track_album
    set track number tag of spotify_session to track_number
    set comment tag of spotify_session to track_spotify
    set album artist tag of spotify_session to track_album_artist
    if track_disc is not 0 then set disc number tag of spotify_session to track_disc
    start recording spotify_session
   end tell
  end if
  
  -- Stopped playing
  if has_started and player state is not playing then
   tell application "Audio Hijack Pro" to stop recording spotify_session
   set has_started to false
  end if
  
  delay update_delay
 end repeat
 try
  tell application "Audio Hijack Pro" to stop recording spotify_session
 on error number -609
 end try
end tell

Wednesday 27 March 2013

Record Spotify Tracks for Offline listening (Mac)

I recently stumbled upon a YouTube video that showed how to record Spotify songs on your Mac for offline listening. The easiest way is to use an application called 'Audio Hijack Pro' records audio natively from different sources/applications.
After installing this application, you can record Spotify radio as a single track with a press of a button and then manually split the tracks using any audio splitter/ tool.
I wanted to automate this process and a few more clicks on Google I came across a non-working script which gave me some direction into how this can be achieved.
The script attached below will fire off Spotify and 'Audio Hijack Pro' and when the user selects to record, it will split the songs adding some basic ID3 tags along the way. Have fun.

 (* Script to record and tag spotify tracks, by Lloyd Moore *)  
 (* Lloyd's script didn't work for me initially but after few changes it worked! *)  

 tell application "Spotify"  
      repeat  
           try  
                play  
                set currentTrack to (current track)  
                set trackName to (name of current track)  
                tell application "Audio Hijack Pro"  
                     set theSession to my getSession()  
                end tell  
                set loop to true  
                repeat while loop  
                     if trackName is not equal to name of current track then  
                          try  
                               set trackName to name of current track  
                               set trackArtist to artist of current track  
                               set trackAlbum to album of current track  
                               my recordTrack(theSession, trackName, trackArtist, trackAlbum)  
                          on error  
                               set loop to false  
                          end try  
                     end if  
                     delay 1  
                end repeat  
           end try  
           delay 1  
      end repeat  
 end tell  
 on getSession()  
      tell application "Audio Hijack Pro"  
           set sessionName to "spotifySession"  
           try  
                set theSession to first session whose name is sessionName --By name  
           on error  
                set theSession to (make new application session at end of sessions)  
           end try  
           set name of theSession to sessionName  
      end tell  
      return theSession  
 end getSession  
 on recordTrack(theSession, trackName, trackArtist, trackAlbum)  
      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  
                set album tag to trackAlbum  
           end tell  
      end tell  
 end recordTrack  

Sunday 7 August 2011

OS X Lion installation on Dell Inspiron 1520

Coming soon!

OS X Snow Leopard installation on Dell Inspiron 1520

You will need:
  • Dell Inspiron 1520 (preferably a Core 2 Duo with NVIDIA 8600GT)

  • OS X Snow Leopard Retail DVD

Drivers (kexts) and other required files:

  • AppleACPIPS2Nub.kext, ApplePS2Controller.kext, AppleBCM440XEthernet.kext, FakeSMC.kext, FakeSTAC9205.kext, LidSleep.kext, VoodooBattery.kext, VoodooHDA.kext, VoodooPowerMini.kext, VoodooSDHC.kext

  • DSDT.aml, smbios.plist, com.apple.Boot.plist

Download all files here

BIOS Settings:

Under SATA option, select AHCI mode.

Installation Steps:

  • Boot from iBoot and on the
    selection screen swap the DVD with OS/X Retail. Press F5 to refresh
    and select Mac OS/X Installation. You should now see a grey screen
    with an Apple logo. If everything goes well you will see the
    language selection screen.

  • From the Menu, Select Utilities -> Disk Utility,

    • Select your hard drive from the left pane and click on 'Partition'.

    • Click 'Options' at the bottom and select 'GUID Partition Table'.

    • Select 'Mac OS Extended (Journaled)' from Format drop-down options.

    • Finally, click Apply.

  • Close Disk Manager and continue with the installation. This will take around 30 minutes to complete.

First Boot:

  • Upon reboot, swap the DVD with the iBoot and boot from it. This is because there is no boot loader currently installed on the HD.

  • When presented with the selection screen, select OS X (or whatever you named your OS/X partition).

  • This will boot OS/X for the first time and you will be presented with Initial setup screen. You can skip the registration screen and continue to the account creation. Once done, you will log into OS/X.

  • Run MultiBeast and select the following options:

Drivers & Bootloaders -> Bootloaders -> Chimera v1.4.1 r877

  • Unzip the downloaded file (above) and copy SLE folder contents to /System/Library/Extensions folder.

If using terminal, the command will be:

sudo cp -R SLE /System/Library/Extensions

  • Now copy the contents of the Extra folder from the zip file to /Extra

sudo mkdir /Extra
sudo cp -R Extra /Extra

  • Run Kext Utility and it will fix any permission issues.

  • Reboot using HD and it should boot up fine.

Now you have a fully functional OS/X 10.6.3


You can download the 10.6.7 combo upgrade to upgrade your OS/X. Every time you upgrade, you will need to copy the drivers (kext files) in /System/Library/Extensions folder and run Kext Utitlity.

Tuesday 26 July 2011

OS-X Snow Leopard installation on Dell Inspiron 6400

I bought a cheap Dell Inspiron 6400 from Ebay with the intention of trying out OS/X Snow Leopard (10.6) on it.

Pre reqs:
- Dell Inspiron 6400 (preferably a Core 2 Duo).
- OS X Snow Leopard Retail DVD

Drivers you need:
- AppleIntelIntegratedFramebuffer.kext (if you have onboard Intel graphics)
- VoodooTSYC.kext
- AppleBCM440XEthernet.pkg

BIOS Settings:
Disable Multiple Cores. We will enable them in the end.
If there is SATA option, select AHCI mode.

Installation Steps:
- Boot from iBoot and on the selection screen swap the DVD with OSX Retail. Press F5 to refresh and select Mac OSX Installation. You should now see a grey screen which an Apple logo. If everything goes well you will see the first OS X installation screen where you select a language.
- In my case, the screen went black for some reason. I tried connecting to an external monitor and it worked.
- From the Menu, Select Utilities -> Disk Utility and format the HD with Mac OS Extended (Journaled). Also click on options to select partition type as GUID partition.
- Continue further and the installation will begin. This will take around 30 minutes to complete.

First Boot:
- Upon reboot, swap the DVD with the iBoot and boot from it. This is because there is no boot loader currently installed on the HD.
- When presented with the selection screen, select OSX or whatever you named your OSX partition.
- Once again, the display will output on the External monitor.
- If you have onboard Intel Graphics, copy the Intel 950 Graphics file 'AppleIntelIntegratedFramebuffer.kext' to the Desktop and use KextBeast to install it. You can find this file on http://www.kexts.com/.
- If you have NVIDIA or ATI graphics card, you don't need a driver (kext) for it but instead enable the option in Multibeast (See below).
- Reboot and now you should see the output of graphics on the laptop LCD and if your external monitor is connected it will be configured properly.
- Now run Multi Beast and select the following options:
- EasyBeast Install
- Drivers & Bootloaders -> Kexts & Enablers -> Audio -> Universal -> VoodooHDA 0.2.1
- Drivers & Bootloaders -> Miscellaneous -> Voodoo PS/2 Controller
- Drivers & Bootloaders -> Miscellaneous -> Voodoo PS/2 Trackpad
- This should install the boot loader, and other important stuff.

- Reboot now using HD (Eject the iBoot DVD at this stage).
- Now install 'VoodooTSYC.kext' which will enable Core2Duo processor. Install it similarly by copying to Desktop and running KextBeast. Delete the .kext file from desktop after the installation.
- Now finally run 'AppleBCM440XEthernet.pkg' which will install the LAN drivers.
- Reboot and everything should be running.

Finally,
- Go into BIOS and Enable Performance -> Multiple Core option.

Now you have a fully functional OSX 10.6.3

You can download the 10.6.6 or 10.6.7 combo upgrade to upgrade your OS/X. Every time you upgrade, you will need to run Multibeast and select the options described above.