rec-spotify 1.8.1
📻 Record and sync Spotify tracks, albums, and playlists.
License: MIT
Requires Python: >=3.11,<4.0
Keywords: spotify,record

# 📻 Rec-Spotify

![](etc/screen.png)

The program allows you to record Spotify tracks, albums, and playlists with a single simple command. It is also able to fully synchronize your Spotify playlists to a local folder and keep them up-to-date. For now it works **only** on Windows.

Video Guide: [Watch](https://mega.nz/file/nV8XlKzT#yJhTn7TrQR_6TH3J-26-W2hBHL4W_auAAR0nkzwDsgs)

## Requirements

- Python3
- Spotify Premium (no ad blocking functionality)
- [Virtual Audio Cable](https://vb-audio.com/Cable) (recommended, read below)

## Install

```sh
pip install rec-spotify
```

## Usage

First, you need to create a Spotify app to obtain the credentials. You can create an app at the Spotify Developer Dashboard: https://developer.spotify.com/dashboard

Also change Spotify Output Device to Virtual Audio Cable: [Guide](https://youtu.be/EH-VzIpX7e0?t=86)

```sh
# Perform a full synchronization.
rec-spotify --sync

# Record single track/album/playlist.
# Spotify URL format example: https://open.spotify.com/track/42vwak6ZIFMscDhzz3S52f
# Output path format example: C:\Users\<username>\Desktop or just "." to save in current directory
rec-spotify --url <url> --path <where_to_save>

______                 _____             _   _  __       
| ___ \               /  ___|           | | (_)/ _|      
| |_/ /___  ___ ______\ `--. _ __   ___ | |_ _| |_ _   _ 
|    // _ \/ __|______|`--. \ '_ \ / _ \| __| |  _| | | |
| |\ \  __/ (__       /\__/ / |_) | (_) | |_| | | | |_| |
\_| \_\___|\___|      \____/| .__/ \___/ \__|_|_|  \__, |
                            | |                     __/ |
                            |_|                    |___/ 

usage: rec-spotify [-h] [-c] [-s] [-u URL] [-p PATH] [-v]

options:
  -h, --help            show this help message and exit
  -c, --check           Run database cleanup.
  -s, --sync            Synchronize all of your Spotify playlists with local music library.
  -r, --recreate        Create all tracks and playlists stored in the local database to the user`s Spotify account. (Useful for newly created account.)
  -u URL, --url URL     Spotify link or ID for a separate track, playlist, or album.
  -p PATH, --path PATH  The output directory for saving recorded files
  -v, --version         show program's version number and exit
```

## Configration

On the first run, the program will launch a setup wizard. This will prompt you to enter your Spotify app credentials and other required information.

The config file is located at: ```C:\Users\<username>\.rec_spotify\config.ini```

Config example:

```ini
[SPOTIFY]
CLIENT_ID = <SPOTIFY_CLIENT_ID>
CLIENT_SECRET = <SPOTIFY_CLIENT_SECRET>
REDIRECT_URL = <REDIRECT_URL>

[SETTINGS]
MUSIC_DIR = D:\Music
AUDIO_FORMAT = mp3
AUDIO_QUALITY = 320
TRIM_SILENCE = False
```

## FAQ

### 1. What is the purpose of this program?

The answer is simple: I want to have local copies of all my Spotify tracks and playlists in original quality. Because who knows maybe one day i will lose access to my account or something else will happen.

### 2. Why do I need Virtual Audio Cable?

Virtual Audio Cable installation is optional but highly recommended for improved recording quality. It also allows listening to other audio while recording.


## TODO

- [ ] Linux support.
- [x] Trim silence from beginning and end of track.
- [ ] Command-line interface for database management of tracks and playlists.
- [ ] Ad blocking.