Printune is a desktop application for generating 3D printable Spotify code tags.
Main application welcome screen.
Model customization options and preview.
Example of a generated 3D model ready for export.
main.py- Entry point. Starts the application.ui.py- Contains thePrintuneAppclass and all UI logic.modeling.py- Handles 3D model generation and export.utils.py- Utility functions (Spotify parsing, web links, etc).assets/- Contains images, GIFs, and base models.base-models/- STEP files for base models.
- No user-defined functions.
This file only imports and runsPrintuneAppfromui.py.
Main application class for Printune. Handles all UI components and user interactions.
-
__init__(self)
Initializes the main window, sets up state variables, and callscreate_frames()andshow_home_page(). -
create_frames(self)
Create and configure all frames and widgets for the application, including home and customization pages, model selection, and preview panel. -
on_resize(self, event)
Redraws base model buttons with new size if window size changes significantly. -
_on_base_model_select_resize(self, idx)
Handles base model selection when resizing, updates button borders and preview. -
show_home_page(self)
Displays the home page and hides the customization page. -
show_customization_page(self)
Displays the customization page and hides the home page. -
process_url(self)
Processes the Spotify URL from the input field, fetches and parses the Spotify code, extracts bar heights, and switches to the customization page. -
export_model(self)
Generates the model using the selected base model and bar heights, then prompts the user to save the STL file. -
show_loading_gif(self)
Displays a loading GIF in the preview frame while the model is being generated. -
update_model_preview(self)
Updates the 3D preview in the preview frame with a loading indicator, generates the model in a background thread, and displays the rendered preview.
Generate the model in memory without exporting it.
Args:
bar_heights: List of bar heights extracted from the Spotify code image.selected_base_model: Path to the selected STEP file.
Returns:- A CadQuery Workplane object representing the generated model, or
Noneon error.
Export the given CadQuery model to an STL file.
Args:
model: CadQuery Workplane object to export.file_path: Path to save the STL file.
Open the given URL in the default web browser.
Args:
url: The URL to open.
Parse the Spotify share link and return relevant data.
Args:
share_link: The Spotify share link (string).
Returns:- Tuple of (type, id) if found (e.g.,
("track", "123...")), otherwiseNone.
- Python 3.8 or higher
- Internet connection (for fetching Spotify codes)
- Dependencies listed in
requirements.txt
-
Clone this repository:
git clone https://github.com/yourusername/Printune.git cd Printune -
Install required dependencies:
pip install -r requirements.txt
-
Launch the application:
python main.py -
The main window will appear with a welcome screen.
-
Input a Spotify Link
- Paste a Spotify share URL for any track, album, or playlist
- Click "Generate" to process the link
-
Customize Your Model
- Select from available base models in the gallery
- Adjust any customization options
- Preview the model in real-time
-
Export and Print
- Click "Export" to save your model as an STL file
- Open the STL file with your preferred slicer software
- Print on your 3D printer with recommended settings:
- Layer Height: 0.2mm
- Infill: 15-20%
- Supports: As needed based on model complexity
- Spotify Code Generation: Automatically extracts code patterns from any Spotify link
- Multiple Base Models: Choose from several pre-designed bases for your code
- Real-time 3D Preview: See your model before exporting
- Custom Model Support: Import your own base models (STEP format)
- STL Export: Export directly to 3D-printable STL format
- Invalid URL Error: Ensure you're using a proper Spotify share link
- Model Generation Failure: Check your internet connection
- Preview Not Showing: Make sure all dependencies are correctly installed
- Add new base models to
base-models/. - Customize model generation in
modeling.py. - UI changes go in
ui.py.
MIT License.