This repository contains the code and 3D model files needed to create a custom Spotify keychain. This keychain is designed to incorporate a Spotify code of your favorite song, album, artist, or playlist, which can be scanned to play music directly from Spotify.
The script in this repository uses cadquery
to modify a base 3D model of the keychain by adding a Spotify code to it. Follow these steps to use the code:
-
Setup Python Environment:
- Ensure you have Python installed on your system.
- Install required packages:
cadquery
,requests
,PIL
(Python Imaging Library), andio
. - You can install these packages using
pip install cadquery requests pillow
.
-
Running the Script:
- Open the script in your Python environment.
- Run the script. It will prompt you to enter the link of the song, album, artist, or playlist from Spotify.
-
Input URL Parsing:
- The script parses the provided Spotify link and prepares a URL to fetch the corresponding Spotify code.
-
Downloading the Spotify Code:
- The script downloads the Spotify code as an image based on the parsed data.
-
Loading the Code Image:
- The code image is loaded and processed to determine the bar lengths which are essential to generate the Spotify code's pattern.
-
Editing the Base Model:
- The script then takes a base model of the keychain (in STEP format) and modifies it by adding the Spotify code pattern.
- The model is updated with extrusions representing the unique barcode of your Spotify link.
-
Exporting the Final Model:
- Finally, the script exports the modified model as an STL file, which can be used for 3D printing.
-
3D Printing:
- Use the exported STL file to 3D print your custom Spotify keychain.
You can customize the keychain by using different Spotify links. Each link will generate a unique code that represents the specific song, album, artist, or playlist.