How nchiarappa/spotify-tidal-migration works
Project type and purpose
• This is a small Python CLI application (“script.py”) whose sole purpose is to migrate playlists and tracks between Spotify and Tidal accounts (and between two accounts on the same service).
• It uses two external Python libraries—spotipy (for Spotify) and tidalapi (for Tidal)—to authenticate and call each service’s APIs.
File structure
Top-level files:
• README.md – project description, usage, credentials setup
• requirements.txt – lists spotipy and tidalapi
• script.py – main program with all the functions (connect_to_spotify(), connect_to_tidal(), move_*, copy_*, delete_*)
• .gitignore – ignores secrets.py (user’s credentials file)
There are no subdirectories or microservices—everything lives in one script.
Key insights from README
• You must create a secrets.py holding your user IDs, emails, passwords, and Spotify client credentials.
• The script authenticates to both services, then runs one or more large-grain migration functions.
• Each migration function:
a) fetches playlists or tracks from the source account,
b) transforms them into the destination service’s format,
c) pushes them to the target account or deletes them.
Main components to capture
a. Configuration/Secrets Manager
• secrets.py
• holds credentials, client IDs, tokens
b. Authentication Layer
• connect_to_spotify() → returns Spotipy session/client
• connect_to_tidal() → returns Tidalapi session/client
c. Migration Service Layer
• delete_all_tidal_playlists()
• move_all_tidal_playlists_to_spotify()
• move_one_tidal_playlist_to_spotify(id)
• move_all_spotify_playlists_to_tidal()
• move_favourites_from_spotify_to_tidal()
• move_discover_weekly_from_spotify_to_tidal()
• copy_* functions (between two accounts)
d. External Services
• Spotify Web API (via spotipy)
• Tidal internal API (via tidalapi)
Relationships and data flows
1) User runs script.py
2) script.py imports secrets.py → loads credentials
3) Authentication Layer uses credentials to acquire SpotifySession and TidalSession
4) Migration Service invokes API calls:
– Read data from source session → playlists/tracks metadata
– Transform/map metadata (normalize titles, artists)
– Write data to target session → create playlists/tracks
5) Optionally, handle errors (not shown, but mention retry/fallback if search fails)
Architectural patterns & design principles
• Single-process CLI application
• Layered separation:
• Configuration layer (secrets)
• Authentication layer (session creation)
• Service layer (migration logic)
• Stateless between runs—no database/cache persisted
Technologies, frameworks, libraries
• Python 3.x
• spotipy (Spotify Web API wrapper)
• tidalapi (Tidal Web API wrapper)
• standard library (argparse or direct function calls)