PlaySched - Spotify Playlist Scheduler
A comprehensive project combining a web application for scheduling Spotify playlist playback and a command-line tool for direct Spotify control, history management, and data synchronization. Born from the frustration of using Amazon Alexa’s terrible music scheduling interface, this project provides a superior solution using Spotify’s robust API and better audio equipment.
๐ Project Overview
PlaySched addresses a specific but common need: automated music scheduling that actually works well. Rather than fighting with voice assistant interfaces, this system provides both web-based scheduling and powerful command-line tools for managing Spotify playback across devices.
Key Components
- ๐ฅ๏ธ Web Application (
playsched.py
): User-friendly interface for playlist scheduling - โจ๏ธ Command-Line Tools (
play_spotify_playlist.py
): Direct terminal-based Spotify control - ๐ Data Management: Local SQLite storage for history and synchronization
- ๐ Security: OAuth 2.0 authentication with HTTPS support
- โฐ Scheduling: APScheduler-based automation with timezone support
๐ ๏ธ Technical Architecture
Web Application Features
Authentication & Security:
- Spotify OAuth 2.0 integration with secure token management
- HTTPS-only operation with custom certificate support
- Session management and secure cookie handling
Playlist Management:
- Browse and filter personal Spotify playlists
- Real-time device discovery via Spotify Connect
- Playlist search and organization capabilities
Advanced Scheduling:
|
|
Schedule Management:
- View all schedules sorted by next run time
- Manual trigger (“Play Now”) functionality
- Pause/Resume schedule controls
- Edit and duplicate existing schedules
- Comprehensive deletion with confirmation
Command-Line Interface
Device & Playlist Operations:
|
|
History & Data Management:
|
|
๐ฏ Key Features
Scheduling Capabilities
- Flexible Timing: Start/stop times with optional recurrence
- Day Selection: Specific days of the week or one-time execution
- Device Targeting: Automatic Spotify Connect device detection
- Volume Control: Set playback volume per schedule
- Shuffle Mode: Enable/disable shuffle for each schedule
- Timezone Support: Proper handling of DST and timezone conversions
Data Synchronization
- Local Storage: SQLite database for offline access to playlist data
- History Tracking: Recently played tracks with local time conversion
- Sync Management: Marks removed content without deletion
- Export Options: Excel, CSV, and JSON export formats
- Data Integrity: Comprehensive error handling and validation
Security Implementation
- HTTPS Enforcement: Required for Spotify API callbacks
- Custom Certificates: Script-generated CA and server certificates
- Token Management: Secure OAuth token caching and refresh
- Environment Variables: Sensitive data stored in
.env
files
๐ Technical Implementation
Database Schema
|
|
Flask Application Structure
|
|
๐ง Installation & Setup
Prerequisites
- Python 3.8+ with pip or conda
- OpenSSL for certificate generation
- Spotify Account (regular or Premium)
- Spotify Developer App credentials
Quick Start
|
|
Spotify Developer Setup
- Register Application: Visit Spotify Developer Dashboard
- Configure Callback: Add
https://127.0.0.1:9093/callback
to Redirect URIs - Copy Credentials: Client ID and Client Secret to
.env
file - Set Permissions: Required scopes for playback control
๐ก Problem-Solving Approach
Original Challenge
The project originated from frustration with Amazon Alexa’s music scheduling interface:
- Cumbersome voice commands for time-based music control
- Limited playlist management capabilities
- Poor user interface for schedule modification
- Inferior audio quality compared to dedicated speakers
Technical Solution
- Better Interface: Web-based scheduling with visual playlist selection
- Superior Audio: Utilizes existing high-quality speakers via Spotify Connect
- Flexible Control: Both GUI and CLI interfaces for different use cases
- Data Ownership: Local storage and export capabilities
- Extensibility: Modular design allows for future enhancements
๐ฎ Roadmap & Future Development
Planned Features (v0.2.x)
- Multiple user support with authentication
- Advanced scheduling patterns (monthly, yearly)
- Playlist analysis and recommendation engine
- Mobile-responsive interface improvements
- Real-time playback status monitoring
Advanced Features (v1.0+)
- Smart home integration (Home Assistant, etc.)
- Machine learning-based scheduling suggestions
- Multi-room audio coordination
- Advanced analytics and listening insights
- Plugin architecture for extensibility
Technical Improvements
- Docker containerization for easy deployment
- Database migration system
- Enhanced error handling and logging
- Performance optimizations for large playlist collections
- Integration testing suite
๐ Impact & Usage
Personal Productivity
- Daily Automation: Seamless morning and evening music routines
- Device Management: Effortless switching between audio devices
- Data Insights: Understanding of listening patterns and preferences
Technical Achievements
- API Integration: Comprehensive Spotify Web API implementation
- Scheduling Logic: Robust timezone and DST handling
- Security Implementation: Production-ready HTTPS and OAuth flow
- Data Management: Efficient SQLite operations with export capabilities
Community Value
- Open Source: MIT licensed for community contribution
- Documentation: Comprehensive setup and usage guides
- Modularity: Reusable components for other Spotify projects
๐ ๏ธ Technologies & Dependencies
Core Technologies
- Backend: Python 3.8+, Flask web framework
- Database: SQLite with optimized queries
- Authentication: Spotipy OAuth 2.0 wrapper
- Scheduling: APScheduler with timezone support
- Security: pyOpenSSL for HTTPS certificates
Key Libraries
|
|
Development Tools
- Version Control: Git with semantic versioning
- Code Style: PEP 8 compliance with automated formatting
- Documentation: Markdown with comprehensive examples
- Testing: Manual testing with planned automated test suite
๐ Resources
- GitHub Repository - Complete source code and documentation
- Contact - Questions, feedback, and collaboration
- Storizzi - Professional development and consulting services
Current Version: v0.1.1 (June 2025) - Ready for production use with ongoing enhancements planned.
PlaySched represents the intersection of practical problem-solving, robust technical implementation, and user-centered design - transforming a daily frustration into a seamless, automated experience.