A bash script to record music from Spotify to acc or ogg files
- Spotify client
- fdkaac
- oggenc (usually in vorbis-tools)
- Clone this repository or download the file spotifyripper.sh
- Make shure that the file is executable
chmod +x spotifyripper.sh
- Disable the autoplay feature in the Spotify client. That is nessesary for the script to know when to stop recording
- Play anything in spotify to create the pulseaudio sink for the first time
- Execute the script
./spotifyripper.sh
- Optinal: Install any missing dependencies. For exemple in debian/ubuntu
sudo apt install fdkaac vorbis-tools
and repeat the step 5
Recommended steps:
- Use a Spotify Premium account. I have made all the testing with a premium account.
- Is better if you use a virtual machine or a dedicated computer to let Spotify run while you record. Some DE tend to switch to the null audio output al all applications
- Disable the sound of the notifications on your DE
- Do not use any application that could use sound while recording
- Create a "bin" directory in your home directory and copy the script there to be able to execute the script in any path.
mkdir ~/bin
cp spotifyripper.sh ~/bin
- To record first go to the destination directory and then execute the script
cd Music
spotifyripper.sh
All are optional. You can give as first argument the destination directory. It defaults to the same directory that the script is called. Copy the file spotifyripper.conf.example to spotifyripper.conf and keep it in the same directory as the script.
cp spotifyripper.conf.example spotifyripper.conf
This are the options avaliable:
Posible values: "aac" or "ogg"
Example:
recordformat="ogg"
Default: "aac"
Only aplies to the aac format. Ignored when ogg is used
Posible values: Any supported by fdkaac
Example:
aac_profile="5"
Default: "29"
Posible values: Any supported by fdkaac or oggenc
Example:
bitrate="192"
Default: "48"
Set the output file name / directory scheme
Posible values:
- "normal" : Based on Artist / Album / Tittle
- "strict" : Based on Artist / Album / Tittle removing all special characters
- "strict-lc-nodir" : Creates no directory structure. It removes the special characters and converts to lower case the filename
Example:
filenamescheme="normal"
Default: "normal "