{"id":49575213,"url":"https://github.com/rollecode/spotify-my-station","last_synced_at":"2026-05-03T16:11:03.734Z","repository":{"id":302120822,"uuid":"1011332397","full_name":"rollecode/spotify-my-station","owner":"rollecode","description":"Automatic Spotify playlist that mimics Apple's My Station. Play with Smart Shuffle.","archived":false,"fork":false,"pushed_at":"2026-01-22T13:16:03.000Z","size":290,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-02T13:33:33.543Z","etag":null,"topics":["apple","apple-music","lastfm","lastfm-api","music","spotify","spotify-api","spotify-web-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rollecode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-30T16:46:05.000Z","updated_at":"2026-01-22T13:16:07.000Z","dependencies_parsed_at":"2025-10-28T17:26:06.428Z","dependency_job_id":"5d747149-8cc8-4eea-812f-dc046a6d00cb","html_url":"https://github.com/rollecode/spotify-my-station","commit_stats":null,"previous_names":["ronilaukkarinen/spotify-my-station","rollecode/spotify-my-station"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/rollecode/spotify-my-station","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollecode%2Fspotify-my-station","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollecode%2Fspotify-my-station/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollecode%2Fspotify-my-station/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollecode%2Fspotify-my-station/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rollecode","download_url":"https://codeload.github.com/rollecode/spotify-my-station/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollecode%2Fspotify-my-station/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32575400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apple","apple-music","lastfm","lastfm-api","music","spotify","spotify-api","spotify-web-api"],"created_at":"2026-05-03T16:11:03.053Z","updated_at":"2026-05-03T16:11:03.729Z","avatar_url":"https://github.com/rollecode.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎵 Spotify My Station\n\n![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54) ![Spotify](https://img.shields.io/badge/Spotify-1DB954?style=for-the-badge\u0026logo=spotify\u0026logoColor=white) ![Last.fm](https://img.shields.io/badge/last.fm-D51007?style=for-the-badge\u0026logo=last.fm\u0026logoColor=white) ![Chagtgpt](https://img.shields.io/badge/OpenAI-74aa9c?style=for-the-badge\u0026logo=openai\u0026logoColor=white) ![Google Gemini](https://img.shields.io/badge/Google%20Gemini-4285F4?style=for-the-badge\u0026logo=google\u0026logoColor=white) ![Version](https://img.shields.io/badge/version-2.6.0-blue?style=for-the-badge)\n\n![image](https://github.com/user-attachments/assets/6c3e1c17-483e-450f-ae59-60564c69548b)\n\nA Python script that automatically creates an Apple Music \"My Station\"-style playlist on Spotify with quality-filtered recommendations. Combines 50% favorites with 50% discovery (AI + Last.fm), while filtering out obscure artists and low-quality tracks.\n\n![Screenshot from 2025-06-30 19-49-25](https://github.com/user-attachments/assets/38b60f90-2725-4b56-9897-e644b5df7d1b)\n\n## Features\n\n- **Balanced discovery**: 50% favorites and 50% new tracks, blending familiarity with discovery\n- **Apple Music My Station experience**: Mimics Apple Music's intelligent station algorithm\n- **Recent Obsessions Mode**: Optional `--recent-obsessions-mode` flag for genre-coherent playlists based on last 7 days\n- **Smart mix**:\n  - 50% your favorites (weighted by playcount, with 3+ day cooldown)\n  - 20% AI discovery (GPT-5-mini or Gemini suggests NEW artists based on your taste)\n  - 30% Last.fm discovery (similar artists from Last.fm collaborative filtering)\n- **Quality filtering**: Blocks obscure artists (\u003c 10k listeners), Christmas songs, AI-generated music, covers\n- **Unlimited history tracking**: Tracks every song ever suggested with timestamps\n- **Intelligent cooldown**: Minimum 3 days between repeats, overplay protection\n- **Genre filtering**: Ban entire genres from your playlists\n- **Automatic updates**: Runs hourly via cron job with fresh discoveries each time\n- **Comprehensive logging**: Detailed logs showing discovery sources\n\n**Note:** Spotify deprecated their Audio Features and Recommendations APIs on November 27, 2024.\n\n## Requirements\n\n- Python 3.6+\n- Last.fm account with API access\n- Spotify account with API access\n- A Spotify playlist to update\n- **OpenAI API key OR Google Gemini API key** (required for AI features)\n\n## Setup\n\n### 1. Virtual environment setup\n\nCreate and activate a virtual environment:\n\n```bash\n# Create virtual environment\npython3 -m venv venv\n\n# Activate virtual environment\n# On Linux/Mac:\nsource venv/bin/activate\n# On Windows:\n# venv\\Scripts\\activate\n```\n\n### 2. Install dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### 3. API setup\n\n#### Last.fm API\n\n1. Go to https://www.last.fm/api/account/create\n2. Create an API account and get your API key and secret\n\n#### Spotify API\n\n1. Go to https://developer.spotify.com/dashboard\n2. Create a new app and get your client ID and secret\n3. **IMPORTANT**: In \"Redirect URIs\", add exactly: `https://developer.spotify.com/callback`\n   - Click \"Add URI\" and enter `https://developer.spotify.com/callback`\n   - Click \"Save\" at the bottom of the page\n   - This URI must match what's in your `.env` file\n   - **Note**: This is Spotify's own testing redirect URI\n\n### 4. Environment configuration\n\nCopy the `.env.example` file to `.env` and fill in your credentials:\n\n```bash\ncp .env.example .env\n```\n\nEdit `.env` with your API credentials:\n\n```env\nLASTFM_API_KEY=your_lastfm_api_key\nLASTFM_API_SECRET=your_lastfm_api_secret\nLASTFM_USERNAME=your_lastfm_username\nLASTFM_PASSWORD=your_lastfm_password\n\nSPOTIPY_CLIENT_ID=your_spotify_client_id\nSPOTIPY_CLIENT_SECRET=your_spotify_client_secret\nSPOTIPY_REDIRECT_URI=https://developer.spotify.com/callback\nSPOTIFY_PLAYLIST_ID=your_spotify_playlist_id\n\n# AI API credentials and configuration (required)\nAI_PROVIDER=openai  # Options: openai, gemini\nOPENAI_API_KEY=your_openai_api_key  # Also accepts OPEN_AI_API_KEY\nGEMINI_API_KEY=your_gemini_api_key\n\nLOG_FILE=/path/to/your/spotify-my-station.log\nNUMBER_OF_TRACKS=100\n```\n\n### 5. Get Spotify playlist ID\n\n1. Open Spotify and navigate to your playlist\n2. Click \"Share\" \u003e \"Copy link to playlist\"\n3. Extract the playlist ID from the URL (the part after `/playlist/`)\n\n### 6. First run authentication\n\nThe script handles Spotify authentication with clear terminal instructions:\n\n#### First run process\n\n1. Script displays an authorization URL\n2. Copy this URL and open it in your browser\n3. Log in to Spotify and click \"Agree\" to authorize\n4. You'll be redirected to `https://developer.spotify.com/callback?code=...` (Spotify's own page will show an error - this is normal!)\n5. **Copy the entire URL from your browser's address bar** (including the `?code=...` part)\n6. Paste this URL back into the terminal when prompted\n7. Script saves token to `.spotify_cache` for future runs\n\n**Security note**: Using Spotify's own developer callback URL is completely safe - it's their official testing redirect URI.\n**Subsequent runs**: Uses cached tokens automatically (no interaction needed)\n\n## Usage\n\n### Basic Usage\n\n```bash\npython spotify-my-station.py\n```\n\n**AI-powered by default!** The script creates intelligent playlists that mimic Apple Music's \"My Station\" feature with quality filtering.\n\n**How it works:**\n- Analyzes your entire Last.fm loved tracks collection\n- Creates an intelligent mix of familiar favorites and new discoveries\n- Learns from your listening patterns and playlist update history\n- Balances songs you love with AI-curated recommendations based on your taste\n- Filters out obscure artists, Christmas music, covers, and AI-generated tracks\n\n**Mix Strategy:**\n- 50% songs from your loved tracks collection (weighted by playcount)\n- 20% tracks from AI-recommended artists based on your taste analysis\n- 30% songs from similar artists discovered via Last.fm recommendations\n\n**Quality Control:**\n- Only artists with 10,000+ Last.fm listeners\n- Blocks Christmas songs, AI music, covers, tributes, karaoke\n- One track per artist for maximum variety\n\n### Custom Playlist\n\n```bash\npython spotify-my-station.py --playlist PLAYLIST_ID\n```\nUpdates a specific playlist instead of the default one from environment variables.\n\n### Recent Obsessions Mode\n\n```bash\npython spotify-my-station.py --recent-obsessions-mode\n```\n\nEmphasizes your current listening patterns (last 7 days) instead of all-time favorites. Creates more genre-coherent playlists based on what you've been into lately.\n\n**Mix Strategy:**\n- 10 top obsession tracks (your most played songs from last 30 days)\n- 50% tracks from artists you've been playing in the last 7 days\n- 25% similar artists to your current obsessions\n- 15% classics for variety (preferring artists NOT in recent listening)\n\nThis mode is useful when your standard playlist feels too scattered across different genres/moods. It focuses on your current vibe instead of mixing electronic, black metal, classic rock, etc. all together.\n\nFalls back to standard mode automatically if no recent listening data is found.\n\n### Genre Filtering\n\nCreate a `banned.json` file to filter out unwanted genres:\n\n```json\n{\n  \"banned_items\": [\n    \"song:Hello Kitty\",\n    \"artist:Streetgazer\", \n    \"genre:hip hop\",\n    \"genre:rap\"\n  ]\n}\n```\n\nUse the provided `banned.example.json` as a template. Supported prefixes:\n- `song:` - Ban specific songs\n- `artist:` - Ban all songs by an artist\n- `album:` - Ban all songs from an album\n- `genre:` - Ban all songs with this genre\n\n### Help\n\n```bash\npython spotify-my-station.py --help\n```\n\nAvailable options:\n- `--playlist PLAYLIST_ID` - Update a specific playlist\n- `--recent-obsessions-mode` - Emphasize recent listening patterns\n\n### Automated runs with cron\n\nTo run the script automatically every hour:\n\n1. Open your crontab:\n   ```bash\n   crontab -e\n   ```\n\n2. Add this line:\n   ```bash\n   # Spotify My Station (standard mode)\n   0 * * * * cd /home/rolle/spotify-my-station \u0026\u0026 /home/rolle/spotify-my-station/venv/bin/python spotify-my-station.py --playlist xxxxxxxxxxx \u003e\u003e /dev/null 2\u003e\u00261\n\n   # Or with recent obsessions mode for genre-coherent playlists\n   0 * * * * cd /home/rolle/spotify-my-station \u0026\u0026 /home/rolle/spotify-my-station/venv/bin/python spotify-my-station.py --playlist xxxxxxxxxxx --recent-obsessions-mode \u003e\u003e /dev/null 2\u003e\u00261\n   ```\n\n## Configuration\n\nThe script can be configured through environment variables in the `.env` file:\n\n- `NUMBER_OF_TRACKS`: Number of tracks to add to the playlist (default: 100)\n- `LOG_FILE`: Path to the log file\n\n## Logging\n\nThe script logs all operations to both the console and a log file. Check the log file for detailed information about:\n- Authentication status\n- Number of tracks processed\n- Tracks not found on Spotify\n- Error messages\n\n## Troubleshooting\n\n1. **Authentication issues**: Make sure your API credentials are correct in the `.env` file\n2. **Playlist not updating**: Verify the playlist ID and ensure your Spotify app has the correct permissions\n3. **Tracks not found**: Some Last.fm tracks might not be available on Spotify\n4. **Permission errors**: Ensure the script has write permissions for the log file location\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frollecode%2Fspotify-my-station","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frollecode%2Fspotify-my-station","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frollecode%2Fspotify-my-station/lists"}