[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78X1ET3S7GMT9YCBF1BGFGR":3,"skill-same:01M78X1ET3S7GMT9YCBF1BGFGR":85},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":60,"commitSha":61,"skillDirectory":62,"forksCount":13,"repositoryHtmlUrl":63,"repositoryHomepageUrl":6,"ownerHtmlUrl":64,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":65,"install":66,"resources":78},"01M78X1ET3S7GMT9YCBF1BGFGR","youtube-music-cast",null,"Download music from YouTube\u002FYouTube Music and stream to Chromecast via Home Assistant. Complete CLI toolset with web server integration, configuration wizard, and playback controls.","meghal86\u002Fstacksignal","meghal86","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F37388715?v=4","01M6CS2EW8SK89GH52R2ZEN8QQ","01M728J5CGY456EETEFG6HJBTM",0,"MIT","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fyoutube-music-cast\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: youtube-music-cast\ndescription: Download music from YouTube\u002FYouTube Music and stream to Chromecast via Home Assistant. Complete CLI toolset with web server integration, configuration wizard, and playback controls.\nversion: \"6.0.0\"\nauthor: Wobo\nlicense: MIT\nhomepage: https:\u002F\u002Fgithub.com\u002Fclawdbot\u002Fskills\nrepository: https:\u002F\u002Fgithub.com\u002Fclawdbot\u002Fskills\u002Ftree\u002Fmain\u002Fyoutube-music-cast\nuser-invocable: true\ntriggers:\n  - play music\n  - cast to chromecast\n  - youtube music\n  - download music\n  - cast music\nkeywords:\n  - youtube\n  - music\n  - chromecast\n  - home-assistant\n  - cast\n  - media-player\n  - streaming\n  - yt-dlp\n  - google-cast\n  - audio\n  - mp3\n  - free-music\ncategory: media\nrequires:\n  bins:\n    - yt-dlp\n    - python3\n    - curl\n    - jq\n  env: []\nconfig:\n  stateDirs:\n    - ~\u002F.youtube-music-cast\nmetadata:\n  clawdbot:\n    emoji: \"🎵\"\n\n---\n\n# YouTube Music Cast\n\nYouTube music → your Chromecast. Simple, free, works.\n\nDownload audio from YouTube or YouTube Music and stream it through Home Assistant to any Cast-enabled device. No subscriptions, no cloud services, just your local network.\n\n## Features\n\n- ✅ **Free forever** — No subscriptions, no premium accounts needed\n- ✅ **High quality** — 320K MP3, crystal clear audio\n- ✅ **Video mode** — Create MP4 videos with album art and text overlays\n- ✅ **Radio mode** — Auto-discover and play related songs\n- ✅ **Local storage** — Your music stays on your machine, no cloud\n- ✅ **Multi-room** — Cast to any Chromecast device in your home\n- ✅ **Batch download** — Download entire playlists, stream anytime\n- ✅ **Simple CLI** — Fast commands, no browser required\n- ✅ **Works offline** — Once downloaded, music is yours to keep\n\n## Use Cases\n\n### Daily Music\nDownload your favorite tracks in the morning, cast them throughout the day. No waiting, no buffering.\n\n### Party Mode\nDownload a playlist before guests arrive, then queue up songs without fumbling with phones or apps.\n\n### Background Audio\nPlay ambient music or podcasts while you work without worrying about ads or interruptions.\n\n### Multi-Room Sync\nStream the same track to multiple Chromecasts simultaneously (bedroom + living room + kitchen).\n\n## Why This Over Premium Services?\n\n| Feature | YouTube Music Cast | Spotify Premium | YouTube Premium |\n|---------|-------------------|------------------|------------------|\n| Cost | Free forever | $10.99\u002Fmonth | $13.99\u002Fmonth |\n| Quality | 320K MP3 | Up to 320K | Up to 1080p video |\n| Offline | Yes, forever | Download limit | Download limit |\n| Ads | None | None | None |\n| Platforms | Any Chromecast | Spotify Connect devices | YouTube apps |\n| Privacy | Local only | Cloud-based | Cloud-based |\n\n## Quick Start\n\n```bash\n# 1. Setup (one time, takes 2 minutes)\ncast-setup\n\n# 2. Download your first song\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ\n\n# 3. Start the web server\ncast-server start\n\n# 4. Cast it to your default device\ncast-play never-gonna-give-you-up.mp3\n```\n\nThat's it. Your music is playing through your Chromecast.\n\n## What This Does\n\nThree simple steps, one command each:\n\n### 1. Download\n`yt-dlp` grabs audio from YouTube or YouTube Music, extracts it as MP3 (320K quality).\n\n### 2. Host\nA lightweight Python HTTP server makes your downloaded files accessible over your local network. No setup required — just Python 3.\n\n### 3. Cast\nHome Assistant's `media_player.play_media` service sends the HTTP URL to your Chromecast, which streams the audio.\n\n### Why a Web Server?\n\nHome Assistant's `play_media` service requires a URL, not a file path. The web server bridges that gap.\n\n```yaml\n# ✅ This works — HA can fetch via HTTP\nmedia_content_id: \"http:\u002F\u002F192.168.1.81:8735\u002Fsong.mp3\"\n\n# ❌ This fails — HA can't read file paths\nmedia_content_id: \"\u002Ftmp\u002Fyoutube-music\u002Fsong.mp3\"\n```\n\n**Architecture:**\n```\nYouTube URL → yt-dlp → MP3 file → Python HTTP server → Home Assistant API → Chromecast\n```\n\n## Installation\n\n### What You Need\n\n- **Home Assistant** with Google Cast integration\n- **Chromecast** or Cast-enabled device (Nest speakers, Google Home, TV)\n- **System tools:** `yt-dlp`, Python 3, `curl`, `jq`\n\n### Step 1: Install Scripts\n\n```bash\n# Clone or download the skill\ncd youtube-music-cast\n\n# Make all scripts executable\nchmod +x scripts\u002F*\n\n# Install globally (recommended)\n.\u002Finstall.sh --global\n\n# Or install locally\n.\u002Finstall.sh\n```\n\n### Step 2: Run Setup Wizard\n\n```bash\ncast-setup\n```\n\nThe wizard will ask for:\n- **Home Assistant URL** — e.g., `http:\u002F\u002Fhomeassistant.local:8123`\n- **Long-Lived Access Token** — Generate in HA → Profile → Long-Lived Access Tokens\n- **Server IP** — The machine running these scripts\n- **Default media player** — e.g., `media_player.bedroom_display`\n\n### Step 3: Test Your Setup\n\n```bash\n# Download a test song\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ\n\n# Start the server\ncast-server start\n\n# Cast it\ncast-play song.mp3\n```\n\nIf music plays, you're ready!\n\n## Commands\n\n| Command | Description | Example |\n|---------|-------------|----------|\n| `cast-setup` | Run configuration wizard | `cast-setup` |\n| `cast-download \u003CURL> [options]` | Download from YouTube\u002FYouTube Music | `cast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=... --video` |\n| `cast-radio \u003CURL> [options]` | Start radio mode with related songs | `cast-radio https:\u002F\u002Fyoutube.com\u002Fwatch?v=... --count 10` |\n| `cast-server [start|stop|status]` | Manage HTTP server | `cast-server start` |\n| `cast-play \u003Cfile> [device]` | Cast music or video file to device | `cast-play song.mp4` |\n| `cast-stop [device]` | Stop playback | `cast-stop` |\n| `cast-status [device]` | Show player status | `cast-status` |\n| `cast-devices` | List all available media players | `cast-devices` |\n| `cast-list` | List downloaded files | `cast-list` |\n| `cast-help` | Show help | `cast-help` |\n\n## Usage Guide\n\n### Your First Song\n\n```bash\n# Download from YouTube\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ\n\n# Rename for cleaner URL (recommended)\nmv \"\u002Ftmp\u002Fyoutube-music\u002FRick Astley - Never Gonna Give You Up.mp3\" \\\n   \"\u002Ftmp\u002Fyoutube-music\u002Fnever-gonna-give-you-up.mp3\"\n\n# Start the web server\ncast-server start\n\n# Cast to your default device\ncast-play never-gonna-give-you-up.mp3\n```\n\n### Cast to Different Rooms\n\n```bash\n# Living room TV\ncast-play song.mp3 media_player.living_room\n\n# Kitchen speaker\ncast-play song.mp3 media_player.kitchen_speaker\n\n# Bedroom Chromecast\ncast-play song.mp3 media_player.bedroom_display\n\n# Multiple rooms at once (run multiple commands)\ncast-play song.mp3 media_player.living_room & \\\ncast-play song.mp3 media_player.bedroom_display\n```\n\n### Check What's Playing\n\n```bash\n# Default device\ncast-status\n\n# Specific device\ncast-status media_player.bedroom_display\n```\n\nOutput:\n```\n📺 media_player.bedroom_display\n\nState: playing\nFriendly Name: Bedroom display\nVolume: 22%\n\nNow Playing:\n  Title: Never Gonna Give You Up\n  Artist: Rick Astley\n  Duration: 3:32\n\nApp: Default Media Receiver\n```\n\n### Stop Playback\n\n```bash\n# Stop default device\ncast-stop\n\n# Stop specific device\ncast-stop media_player.living_room\n```\n\n### See What You've Downloaded\n\n```bash\n# List all music files with sizes\ncast-list\n```\n\nOutput:\n```\n🎵 Downloaded Music\n\nboneheads-bank-holiday.mp3                                    9.3M\nnever-gonna-give-you-up.mp3                                 8.2M\nsong-for-nary.mp3                                          7.8M\n\nTotal: 3 files\n```\n\n### See Available Devices\n\n```bash\ncast-devices\n```\n\nOutput:\n```\n📺 Available Media Players\n\nmedia_player.bedroom_display\n  Name: Bedroom display\n  State: idle\n  Supported: play_media, volume_set, volume_mute, ...\n\nmedia_player.living_room\n  Name: Living room TV\n  State: off\n  Supported: play_media, volume_set, ...\n\nDefault device: media_player.bedroom_display\n```\n\n## New Features: Radio Mode & Video Mode\n\n### 📻 Radio Mode\n\nRadio mode automatically discovers and downloads related songs based on YouTube recommendations. After downloading a seed song, it searches for similar tracks and adds them to your queue.\n\n**Start radio mode:**\n\n```bash\n# Basic radio (downloads seed + 3 related songs)\ncast-radio https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ\n\n# Custom number of related songs\ncast-radio https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --count 10\n\n# Radio mode with video files\ncast-radio https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --video --count 5\n```\n\n**Or use cast-download with --radio flag:**\n\n```bash\n# Download with radio mode\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --radio\n\n# Download with custom count\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --radio --radio-count 5\n\n# Radio + video mode combined\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --radio --video\n```\n\n**How it works:**\n1. Downloads the seed song you specify\n2. Extracts artist\u002Ftitle from metadata\n3. Searches YouTube for similar videos\n4. Downloads related songs (prefixed with `radio_`)\n5. Related songs are ready to cast in sequence\n\n**Play your radio queue:**\n\n```bash\n# Start server\ncast-server start\n\n# Play the first song\ncast-play $(ls -t \u002Ftmp\u002Fyoutube-music\u002F*.mp3 | head -n 1 | xargs basename)\n\n# Or play related songs sequentially\ncast-play radio_some-song.mp3\ncast-play radio_another-song.mp3\n# ... etc\n```\n\n**Tips:**\n- Related songs are prefixed with `radio_` for easy identification\n- The radio mode searches based on the artist name from the seed song\n- Use `--count` to control how many related songs to download\n- Combine with `--video` flag for visual radio mode\n\n### 🎬 Video Mode with Visuals\n\nVideo mode creates MP4 videos instead of plain MP3 files. Each video includes:\n- The original audio track\n- Album art thumbnail from YouTube\n- Text overlay showing song title and artist\n- Smooth, high-quality encoding\n\n**Download a video:**\n\n```bash\n# Download as MP4 with album art and text\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --video\n\n# Cast the MP4 file\ncast-server start\ncast-play \"Never Gonna Give You Up.mp4\"\n```\n\n**Radio mode with videos:**\n\n```bash\n# Download seed + related songs as videos\ncast-radio https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --video --count 5\n\n# Cast videos\ncast-play \"Never Gonna Give You Up.mp4\"\ncast-play \"radio_Together Forever.mp4\"\n# ... etc\n```\n\n**How it works:**\n1. Downloads the audio track (320K MP3 quality)\n2. Downloads the album art thumbnail from YouTube\n3. Uses ffmpeg to create an MP4 video with:\n   - Looping album art background\n   - Audio track encoded as AAC\n   - Text overlay (song title and artist name) at bottom\n4. Cast the MP4 to your Chromecast (TVs with video support)\n\n**Video output:**\n- Codec: H.264 (libx264)\n- Audio: AAC (192K)\n- Resolution: Same as thumbnail (usually 480p or 720p)\n- Text: White text with semi-transparent black box\n- Compatible with all Chromecast devices with video support\n\n**Notes:**\n- Videos take more space than MP3s (~2-3x larger)\n- Requires ffmpeg to be installed on your system\n- Text overlay uses DejaVu Sans Bold font (included on most Linux systems)\n- Chromecast audio devices (like Google Home Mini) will play audio only\n- Chromecast with displays (TVs, Google Nest Hub) will show the full video\n\n**Requirements for video mode:**\n- `ffmpeg` must be installed on your system\n  ```bash\n  # Debian\u002FUbuntu\n  sudo apt install ffmpeg\n\n  # macOS\n  brew install ffmpeg\n  ```\n\n### Mixed MP3 and MP4\n\n`cast-play` automatically detects the file type:\n- `.mp3`, `.wav`, `.ogg`, `.m4a`, `.flac` → music\n- `.mp4`, `.mkv`, `.webm`, `.mov` → video\n\nYou can mix both formats in the same directory:\n```bash\n# Download some as MP3\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=VIDEO_ID_1\n\n# Download some as MP4\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=VIDEO_ID_2 --video\n\n# Play both - cast-play handles the difference\ncast-play song.mp3\ncast-play video.mp4\n```\n\n## Configuration\n\nConfig file: `~\u002F.youtube-music-cast\u002Fconfig.sh`\n\n```bash\n# Home Assistant\nHA_URL=\"http:\u002F\u002Fhomeassistant.local:8123\"\nHA_TOKEN=\"your-long-lived-access-token-here\"\n\n# Web Server\nSERVER_IP=\"192.168.1.81\"\nSERVER_PORT=\"8735\"\n\n# Default Device (override per command)\nDEFAULT_DEVICE=\"media_player.bedroom_display\"\n\n# Directories\nDOWNLOAD_DIR=\"\u002Ftmp\u002Fyoutube-music\"\nCAST_DIR=\"$HOME\u002F.youtube-music-cast\"\n```\n\n**Edit the file directly** or **re-run `cast-setup`** to update.\n\n## File Naming Best Practices\n\nKeep URLs clean. Simple filenames save you from headaches later.\n\n### The Problem\n\n❌ Bad filenames:\n```\nhttp:\u002F\u002F192.168.1.81:8735\u002FBonehead's%20Bank%20Holiday%20(Remastered).mp3\n```\nThis URL is messy, hard to type, and prone to encoding errors.\n\n### The Solution\n\n✅ Good filenames:\n```\nhttp:\u002F\u002F192.168.1.81:8735\u002Fboneheads-bank-holiday.mp3\n```\nClean, easy to type, no issues.\n\n### Practical Tips\n\n```bash\n# After download, rename immediately\nmv \"Oasis - Bonehead's Bank Holiday (Remastered 1995).mp3\" \\\n   \"oasis-boneheads-bank-holiday.mp3\"\n\n# Use lowercase, hyphens only\nmv \"My Awesome Song.mp3\" \"my-awesome-song.mp3\"\n\n# No special characters\nmv \"song@remix#.mp3\" \"song-remix.mp3\"\n```\n\n**Rule of thumb:**\n- Lowercase\n- Hyphens instead of spaces\n- No special characters (@, #, ?, etc.)\n- Keep it short\n\n## Troubleshooting\n\n### Chromecast Not in Home Assistant\n\n**Problem:** `cast-devices` shows no Chromecast devices.\n\n**Solution:** Add Google Cast integration\n1. Home Assistant → Settings → Devices & Services\n2. Click \"+ Add Integration\"\n3. Search \"Google Cast\" → Select it\n4. Follow the discovery wizard\n\n**If discovery fails:**\n- Ensure Chromecast and Home Assistant are on the same network\n- Try adding manually with Chromecast IP address\n\n### Server Won't Start\n\n**Problem:** `cast-server start` fails or says \"port in use\".\n\n**Solution:**\n```bash\n# Check if port 8735 is in use\nnetstat -tlnp | grep 8735\n# or\nss -tlnp | grep 8735\n\n# Stop any existing server\ncast-server stop\n\n# Try starting manually to see error\ncd \u002Ftmp\u002Fyoutube-music\npython3 -m http.server 8735\n```\n\n**If port is in use by another process:**\nEdit `~\u002F.youtube-music-cast\u002Fconfig.sh`:\n```bash\nSERVER_PORT=\"8736\"  # Change to something else\n```\n\n### \"File Not Found\" Error\n\n**Problem:** `cast-play song.mp3` says file not found.\n\n**Solution:**\n```bash\n# List what's actually there\ncast-list\n\n# Check exact spelling (case-sensitive!)\ncast-play \"Exact-Filename.mp3\"  # Not \"exact-filename.mp3\"\n\n# Verify server is running\ncast-server status\n```\n\n**Common mistakes:**\n- Wrong case: `Song.mp3` vs `song.mp3`\n- Wrong extension: `song.MP3` vs `song.mp3`\n- File in wrong directory: Check `DOWNLOAD_DIR` in config\n\n### Download Fails\n\n**Problem:** `cast-download` errors or hangs.\n\n**Solution:**\n```bash\n# Update yt-dlp (YouTube changes often)\npip install --upgrade yt-dlp\n\n# Check version\nyt-dlp --version\n\n# Try verbose output to see what's wrong\nyt-dlp --verbose \"URL\"\n\n# Try different URL format\n# YouTube: https:\u002F\u002Fyoutube.com\u002Fwatch?v=VIDEO_ID\n# YouTube Music: https:\u002F\u002Fmusic.youtube.com\u002Fwatch?v=VIDEO_ID\n```\n\n**If it's a geo-blocked video:**\nUse a VPN or find an alternative upload of the same track.\n\n### Home Assistant Connection Error\n\n**Problem:** `curl` errors when contacting HA.\n\n**Solution:**\n```bash\n# Test your HA token manually\ncurl -H \"Authorization: Bearer YOUR_TOKEN\" \\\n     -H \"Content-Type: application\u002Fjson\" \\\n     \"http:\u002F\u002Fhomeassistant.local:8123\u002Fapi\u002Fstates\"\n\n# If you see JSON → token is good\n# If 401 Unauthorized → token is wrong or expired\n# If connection refused → URL is wrong or HA is down\n```\n\n**Regenerate token if needed:**\nHA → Profile → Scroll down → Long-Lived Access Tokens → Generate new\n\n### Video Mode Issues\n\n**Problem:** `cast-download --video` fails with \"ffmpeg not found\" or similar error.\n\n**Solution:**\n```bash\n# Check if ffmpeg is installed\nffmpeg -version\n\n# If not found, install it\n# Debian\u002FUbuntu\nsudo apt install ffmpeg\n\n# macOS\nbrew install ffmpeg\n```\n\n**Problem:** Video creation is slow or takes too long.\n\n**Solution:**\n- Video encoding is CPU-intensive. First-time creation may take 10-30 seconds per song.\n- Use MP3 mode (`cast-download` without `--video`) for faster downloads.\n- Consider lowering video quality in the script (edit `cast-download` and change `-preset ultrafast` to `-preset fast` for better quality but slower encoding).\n\n**Problem:** Text overlay doesn't appear or looks wrong.\n\n**Solution:**\n- The script uses DejaVu Sans Bold font. If it's not installed, text won't appear.\n- Install the font:\n  ```bash\n  # Debian\u002FUbuntu\n  sudo apt install fonts-dejavu\n\n  # macOS (usually pre-installed)\n  ```\n- Or edit the script to use a different font path.\n\n**Problem:** Chromecast audio device plays video without visuals.\n\n**Solution:**\n- This is expected behavior. Audio-only Chromecast devices (Google Home Mini, Chromecast Audio) will play the audio track from MP4 files but cannot display video.\n- Use MP3 mode for audio-only devices to save bandwidth and storage.\n\n**Problem:** MP4 files are too large.\n\n**Solution:**\n- Videos are larger than MP3s (typically 2-3x the size).\n- Reduce video bitrate by editing `cast-download` and changing `-b:a 192k` to `-b:a 128k` for audio, or adjust video codec settings.\n- Use MP3 mode if storage is a concern.\n\n### Radio Mode Issues\n\n**Problem:** Radio mode downloads unrelated songs.\n\n**Solution:**\n- Radio mode searches YouTube using the artist name from the seed song.\n- Sometimes the search may return mixed results due to ambiguous artist names.\n- Try using a different seed song with a clearer artist name.\n- The `radio_` prefix makes it easy to identify and remove unwanted downloads.\n\n**Problem:** Radio mode doesn't find any related songs.\n\n**Solution:**\n- Ensure you have a stable internet connection.\n- Check that the seed song has proper metadata (title\u002Fuploader).\n- Try a different seed song — some videos have limited search results.\n- Increase the count with `--radio-count 10` to get more results.\n\n**Problem:** Related songs don't play in sequence automatically.\n\n**Solution:**\n- Radio mode downloads the songs but doesn't auto-play them in sequence.\n- You need to manually play each related song, or create a simple playlist script:\n  ```bash\n  # Play all radio songs in sequence\n  for file in \u002Ftmp\u002Fyoutube-music\u002Fradio_*.mp3; do\n      cast-play \"$(basename \"$file\")\"\n      sleep 5  # Wait between songs\n  done\n  ```\n\n### Cast Commands Hang\n\n**Problem:** `cast-play` doesn't return or music never starts.\n\n**Common causes:**\n1. **Media player is offline** — Check `cast-devices` for state\n2. **Server isn't accessible from HA** — Verify `SERVER_IP` in config matches current IP\n3. **Chromecast network issue** — Restart Chromecast\n4. **Wrong device ID** — Copy exact ID from `cast-devices` output\n\n**Quick fix:**\n```bash\n# Restart everything\ncast-server stop\ncast-server start\ncast-play song.mp3\n\n# Check device is online\ncast-devices\n\n# Try casting from HA UI to isolate issue\n```\n\n## Project Structure\n\n```\nyoutube-music-cast\u002F\n├── scripts\u002F\n│   ├── cast-setup      # Configuration wizard (interactive)\n│   ├── cast-download   # Download from YouTube (uses yt-dlp)\n│   ├── cast-server     # HTTP server manager (start\u002Fstop\u002Fstatus)\n│   ├── cast-play       # Cast to device (HA API)\n│   ├── cast-stop       # Stop playback\n│   ├── cast-status     # Player status query\n│   ├── cast-devices    # List all HA media players\n│   ├── cast-list       # List downloaded files\n│   └── cast-help       # Help documentation\n├── install.sh          # Installation script (--global, --help)\n├── SKILL.md           # This file (ClawdHub skill definition)\n├── README.md          # User-facing documentation\n├── CHANGELOG.md       # Version history\n├── LICENSE            # MIT license\n├── .gitignore        # Protects secrets and state\n└── .clawdhub\u002F\n    └── origin.json    # ClawdHub metadata\n\n~\u002F.youtube-music-cast\u002F\n└── config.sh         # Your configuration (don't commit to Git)\n\n\u002Ftmp\u002Fyoutube-music\u002F\n└── *.mp3            # Downloaded music files\n```\n\n## Requirements\n\n### yt-dlp (YouTube downloader)\n\n```bash\npip install yt-dlp\n```\n\n**Update regularly:** `pip install --upgrade yt-dlp`\n\n### Python 3 (HTTP server)\n\n```bash\n# Check version (usually pre-installed)\npython3 --version\n```\n\n### curl (HTTP client for HA API)\n\n```bash\n# Check version (usually pre-installed)\ncurl --version\n```\n\n### jq (JSON processor)\n\n```bash\n# Debian\u002FUbuntu\nsudo apt install jq\n\n# macOS\nbrew install jq\n```\n\n### ffmpeg (Video mode - optional)\n\nRequired for `--video` flag to create MP4 videos with album art and text overlays.\n\n```bash\n# Debian\u002FUbuntu\nsudo apt install ffmpeg\n\n# macOS\nbrew install ffmpeg\n```\n\n**Check installation:**\n```bash\nffmpeg -version\n```\n\n**Note:** Video mode is optional. If you only download MP3s, you don't need ffmpeg.\n\n## Performance Tips\n\n### 1. Batch Downloads\nDownload multiple tracks or entire playlists at once:\n```bash\n# Download playlist\nyt-dlp -x --audio-format mp3 --audio-quality 320K \\\n  -o \"\u002Ftmp\u002Fyoutube-music\u002F%(playlist_index)s-%(title)s.%(ext)s\" \\\n  \"https:\u002F\u002Fyoutube.com\u002Fplaylist?list=PLAYLIST_ID\"\n\n# Then cast them without waiting\ncast-play 01-song.mp3\ncast-play 02-song.mp3\ncast-play 03-song.mp3\n```\n\n### 2. Keep Server Running\nThe HTTP server is lightweight (~5MB RAM). No need to stop\u002Fstart between casts:\n```bash\n# Start once\ncast-server start\n\n# Cast as many songs as you want\ncast-play song1.mp3\ncast-play song2.mp3\n# ... etc\n```\n\n### 3. Use Default Device\nSet `DEFAULT_DEVICE` in config to avoid typing it every time:\n```bash\n# In ~\u002F.youtube-music-cast\u002Fconfig.sh\nDEFAULT_DEVICE=\"media_player.bedroom_display\"\n\n# Now just cast\ncast-play song.mp3  # Automatically uses bedroom_display\n```\n\n### 4. Clean Up Occasionally\nFiles in `\u002Ftmp\u002F` are cleared on reboot by design, but you can manually clean:\n```bash\n# List all files with sizes\ncast-list\n\n# Remove old files\nrm \u002Ftmp\u002Fyoutube-music\u002F*.mp3\n```\n\n### 5. WiFi Matters\nIf streaming glitches:\n- Move Chromecast to 5GHz WiFi\n- Reduce distance between Chromecast and server\n- Check for WiFi interference\n\n### 6. Alias Commands\nAdd shell aliases for faster access:\n```bash\n# Add to ~\u002F.bashrc or ~\u002F.zshrc\nalias cs='cast-server'\nalias cd='cast-download'\nalias cp='cast-play'\nalias cl='cast-list'\nalias cst='cast-status'\n\n# Now just type\ncs      # Start server\ncd URL   # Download\ncp song  # Cast\ncl       # List\n```\n\n## Notes\n\n- Files are stored in `\u002Ftmp\u002Fyoutube-music\u002F` — cleared on reboot (by design)\n- Web server runs in background, persists across sessions\n- Keep filenames simple: lowercase, hyphens, no spaces\u002Fspecial chars\n- Server and Chromecast must be on same network\n- HA token is stored locally in `config.sh` — **don't commit to Git**\n- Quality is 320K MP3 — good balance of quality and file size\n- No cloud services, no subscriptions, no tracking\n\n## Comparison: This vs Alternatives\n\n| Feature | YouTube Music Cast | Spotify Free | YouTube Premium |\n|---------|-------------------|----------------|-----------------|\n| Cost | Free | Free (with ads) | $13.99\u002Fmonth |\n| Ads | None | Yes, every few songs | None |\n| Offline | Yes, forever | No (premium only) | Yes, with limit |\n| Quality | 320K MP3 | 160K (variable) | Up to 1080p video |\n| Privacy | Local only | Cloud-based | Cloud-based |\n| Platform | Any Chromecast | Spotify Connect | YouTube apps |\n| Queue management | Manual | Built-in | Built-in |\n| Multi-room | Manual | Premium feature | No |\n\n**Bottom line:** If you value privacy, want to own your music, and don't need cloud features, this is for you.\n\n## License\n\nMIT License — use it, modify it, share it.\n\n---\n\n**Version:** 6.0.0\n**Author:** Wobo\n**License:** MIT\n","# YouTube Music Cast\n\nYouTube music → your Chromecast. Simple, free, works.\n\nDownload audio from YouTube or YouTube Music and stream it through Home Assistant to any Cast-enabled device. No subscriptions, no cloud services, just your local network.\n\n## Features\n\n- ✅ **Free forever** — No subscriptions, no premium accounts needed\n- ✅ **High quality** — 320K MP3, crystal clear audio\n- ✅ **Video mode** — Create MP4 videos with album art and text overlays\n- ✅ **Radio mode** — Auto-discover and play related songs\n- ✅ **Local storage** — Your music stays on your machine, no cloud\n- ✅ **Multi-room** — Cast to any Chromecast device in your home\n- ✅ **Batch download** — Download entire playlists, stream anytime\n- ✅ **Simple CLI** — Fast commands, no browser required\n- ✅ **Works offline** — Once downloaded, music is yours to keep\n\n## Use Cases\n\n### Daily Music\nDownload your favorite tracks in the morning, cast them throughout the day. No waiting, no buffering.\n\n### Party Mode\nDownload a playlist before guests arrive, then queue up songs without fumbling with phones or apps.\n\n### Background Audio\nPlay ambient music or podcasts while you work without worrying about ads or interruptions.\n\n### Multi-Room Sync\nStream the same track to multiple Chromecasts simultaneously (bedroom + living room + kitchen).\n\n## Why This Over Premium Services?\n\n| Feature | YouTube Music Cast | Spotify Premium | YouTube Premium |\n|---------|-------------------|------------------|------------------|\n| Cost | Free forever | $10.99\u002Fmonth | $13.99\u002Fmonth |\n| Quality | 320K MP3 | Up to 320K | Up to 1080p video |\n| Offline | Yes, forever | Download limit | Download limit |\n| Ads | None | None | None |\n| Platforms | Any Chromecast | Spotify Connect devices | YouTube apps |\n| Privacy | Local only | Cloud-based | Cloud-based |\n\n## Quick Start\n\n```bash\n# 1. Setup (one time, takes 2 minutes)\ncast-setup\n\n# 2. Download your first song\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ\n\n# 3. Start the web server\ncast-server start\n\n# 4. Cast it to your default device\ncast-play never-gonna-give-you-up.mp3\n```\n\nThat's it. Your music is playing through your Chromecast.\n\n## What This Does\n\nThree simple steps, one command each:\n\n### 1. Download\n`yt-dlp` grabs audio from YouTube or YouTube Music, extracts it as MP3 (320K quality).\n\n### 2. Host\nA lightweight Python HTTP server makes your downloaded files accessible over your local network. No setup required — just Python 3.\n\n### 3. Cast\nHome Assistant's `media_player.play_media` service sends the HTTP URL to your Chromecast, which streams the audio.\n\n### Why a Web Server?\n\nHome Assistant's `play_media` service requires a URL, not a file path. The web server bridges that gap.\n\n```yaml\n# ✅ This works — HA can fetch via HTTP\nmedia_content_id: \"http:\u002F\u002F192.168.1.81:8735\u002Fsong.mp3\"\n\n# ❌ This fails — HA can't read file paths\nmedia_content_id: \"\u002Ftmp\u002Fyoutube-music\u002Fsong.mp3\"\n```\n\n**Architecture:**\n```\nYouTube URL → yt-dlp → MP3 file → Python HTTP server → Home Assistant API → Chromecast\n```\n\n## Installation\n\n### What You Need\n\n- **Home Assistant** with Google Cast integration\n- **Chromecast** or Cast-enabled device (Nest speakers, Google Home, TV)\n- **System tools:** `yt-dlp`, Python 3, `curl`, `jq`\n\n### Step 1: Install Scripts\n\n```bash\n# Clone or download the skill\ncd youtube-music-cast\n\n# Make all scripts executable\nchmod +x scripts\u002F*\n\n# Install globally (recommended)\n.\u002Finstall.sh --global\n\n# Or install locally\n.\u002Finstall.sh\n```\n\n### Step 2: Run Setup Wizard\n\n```bash\ncast-setup\n```\n\nThe wizard will ask for:\n- **Home Assistant URL** — e.g., `http:\u002F\u002Fhomeassistant.local:8123`\n- **Long-Lived Access Token** — Generate in HA → Profile → Long-Lived Access Tokens\n- **Server IP** — The machine running these scripts\n- **Default media player** — e.g., `media_player.bedroom_display`\n\n### Step 3: Test Your Setup\n\n```bash\n# Download a test song\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ\n\n# Start the server\ncast-server start\n\n# Cast it\ncast-play song.mp3\n```\n\nIf music plays, you're ready!\n\n## Commands\n\n| Command | Description | Example |\n|---------|-------------|----------|\n| `cast-setup` | Run configuration wizard | `cast-setup` |\n| `cast-download \u003CURL> [options]` | Download from YouTube\u002FYouTube Music | `cast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=... --video` |\n| `cast-radio \u003CURL> [options]` | Start radio mode with related songs | `cast-radio https:\u002F\u002Fyoutube.com\u002Fwatch?v=... --count 10` |\n| `cast-server [start|stop|status]` | Manage HTTP server | `cast-server start` |\n| `cast-play \u003Cfile> [device]` | Cast music or video file to device | `cast-play song.mp4` |\n| `cast-stop [device]` | Stop playback | `cast-stop` |\n| `cast-status [device]` | Show player status | `cast-status` |\n| `cast-devices` | List all available media players | `cast-devices` |\n| `cast-list` | List downloaded files | `cast-list` |\n| `cast-help` | Show help | `cast-help` |\n\n## Usage Guide\n\n### Your First Song\n\n```bash\n# Download from YouTube\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ\n\n# Rename for cleaner URL (recommended)\nmv \"\u002Ftmp\u002Fyoutube-music\u002FRick Astley - Never Gonna Give You Up.mp3\" \\\n   \"\u002Ftmp\u002Fyoutube-music\u002Fnever-gonna-give-you-up.mp3\"\n\n# Start the web server\ncast-server start\n\n# Cast to your default device\ncast-play never-gonna-give-you-up.mp3\n```\n\n### Cast to Different Rooms\n\n```bash\n# Living room TV\ncast-play song.mp3 media_player.living_room\n\n# Kitchen speaker\ncast-play song.mp3 media_player.kitchen_speaker\n\n# Bedroom Chromecast\ncast-play song.mp3 media_player.bedroom_display\n\n# Multiple rooms at once (run multiple commands)\ncast-play song.mp3 media_player.living_room & \\\ncast-play song.mp3 media_player.bedroom_display\n```\n\n### Check What's Playing\n\n```bash\n# Default device\ncast-status\n\n# Specific device\ncast-status media_player.bedroom_display\n```\n\nOutput:\n```\n📺 media_player.bedroom_display\n\nState: playing\nFriendly Name: Bedroom display\nVolume: 22%\n\nNow Playing:\n  Title: Never Gonna Give You Up\n  Artist: Rick Astley\n  Duration: 3:32\n\nApp: Default Media Receiver\n```\n\n### Stop Playback\n\n```bash\n# Stop default device\ncast-stop\n\n# Stop specific device\ncast-stop media_player.living_room\n```\n\n### See What You've Downloaded\n\n```bash\n# List all music files with sizes\ncast-list\n```\n\nOutput:\n```\n🎵 Downloaded Music\n\nboneheads-bank-holiday.mp3                                    9.3M\nnever-gonna-give-you-up.mp3                                 8.2M\nsong-for-nary.mp3                                          7.8M\n\nTotal: 3 files\n```\n\n### See Available Devices\n\n```bash\ncast-devices\n```\n\nOutput:\n```\n📺 Available Media Players\n\nmedia_player.bedroom_display\n  Name: Bedroom display\n  State: idle\n  Supported: play_media, volume_set, volume_mute, ...\n\nmedia_player.living_room\n  Name: Living room TV\n  State: off\n  Supported: play_media, volume_set, ...\n\nDefault device: media_player.bedroom_display\n```\n\n## New Features: Radio Mode & Video Mode\n\n### 📻 Radio Mode\n\nRadio mode automatically discovers and downloads related songs based on YouTube recommendations. After downloading a seed song, it searches for similar tracks and adds them to your queue.\n\n**Start radio mode:**\n\n```bash\n# Basic radio (downloads seed + 3 related songs)\ncast-radio https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ\n\n# Custom number of related songs\ncast-radio https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --count 10\n\n# Radio mode with video files\ncast-radio https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --video --count 5\n```\n\n**Or use cast-download with --radio flag:**\n\n```bash\n# Download with radio mode\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --radio\n\n# Download with custom count\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --radio --radio-count 5\n\n# Radio + video mode combined\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --radio --video\n```\n\n**How it works:**\n1. Downloads the seed song you specify\n2. Extracts artist\u002Ftitle from metadata\n3. Searches YouTube for similar videos\n4. Downloads related songs (prefixed with `radio_`)\n5. Related songs are ready to cast in sequence\n\n**Play your radio queue:**\n\n```bash\n# Start server\ncast-server start\n\n# Play the first song\ncast-play $(ls -t \u002Ftmp\u002Fyoutube-music\u002F*.mp3 | head -n 1 | xargs basename)\n\n# Or play related songs sequentially\ncast-play radio_some-song.mp3\ncast-play radio_another-song.mp3\n# ... etc\n```\n\n**Tips:**\n- Related songs are prefixed with `radio_` for easy identification\n- The radio mode searches based on the artist name from the seed song\n- Use `--count` to control how many related songs to download\n- Combine with `--video` flag for visual radio mode\n\n### 🎬 Video Mode with Visuals\n\nVideo mode creates MP4 videos instead of plain MP3 files. Each video includes:\n- The original audio track\n- Album art thumbnail from YouTube\n- Text overlay showing song title and artist\n- Smooth, high-quality encoding\n\n**Download a video:**\n\n```bash\n# Download as MP4 with album art and text\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --video\n\n# Cast the MP4 file\ncast-server start\ncast-play \"Never Gonna Give You Up.mp4\"\n```\n\n**Radio mode with videos:**\n\n```bash\n# Download seed + related songs as videos\ncast-radio https:\u002F\u002Fyoutube.com\u002Fwatch?v=dQw4w9WgXcQ --video --count 5\n\n# Cast videos\ncast-play \"Never Gonna Give You Up.mp4\"\ncast-play \"radio_Together Forever.mp4\"\n# ... etc\n```\n\n**How it works:**\n1. Downloads the audio track (320K MP3 quality)\n2. Downloads the album art thumbnail from YouTube\n3. Uses ffmpeg to create an MP4 video with:\n   - Looping album art background\n   - Audio track encoded as AAC\n   - Text overlay (song title and artist name) at bottom\n4. Cast the MP4 to your Chromecast (TVs with video support)\n\n**Video output:**\n- Codec: H.264 (libx264)\n- Audio: AAC (192K)\n- Resolution: Same as thumbnail (usually 480p or 720p)\n- Text: White text with semi-transparent black box\n- Compatible with all Chromecast devices with video support\n\n**Notes:**\n- Videos take more space than MP3s (~2-3x larger)\n- Requires ffmpeg to be installed on your system\n- Text overlay uses DejaVu Sans Bold font (included on most Linux systems)\n- Chromecast audio devices (like Google Home Mini) will play audio only\n- Chromecast with displays (TVs, Google Nest Hub) will show the full video\n\n**Requirements for video mode:**\n- `ffmpeg` must be installed on your system\n  ```bash\n  # Debian\u002FUbuntu\n  sudo apt install ffmpeg\n\n  # macOS\n  brew install ffmpeg\n  ```\n\n### Mixed MP3 and MP4\n\n`cast-play` automatically detects the file type:\n- `.mp3`, `.wav`, `.ogg`, `.m4a`, `.flac` → music\n- `.mp4`, `.mkv`, `.webm`, `.mov` → video\n\nYou can mix both formats in the same directory:\n```bash\n# Download some as MP3\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=VIDEO_ID_1\n\n# Download some as MP4\ncast-download https:\u002F\u002Fyoutube.com\u002Fwatch?v=VIDEO_ID_2 --video\n\n# Play both - cast-play handles the difference\ncast-play song.mp3\ncast-play video.mp4\n```\n\n## Configuration\n\nConfig file: `~\u002F.youtube-music-cast\u002Fconfig.sh`\n\n```bash\n# Home Assistant\nHA_URL=\"http:\u002F\u002Fhomeassistant.local:8123\"\nHA_TOKEN=\"your-long-lived-access-token-here\"\n\n# Web Server\nSERVER_IP=\"192.168.1.81\"\nSERVER_PORT=\"8735\"\n\n# Default Device (override per command)\nDEFAULT_DEVICE=\"media_player.bedroom_display\"\n\n# Directories\nDOWNLOAD_DIR=\"\u002Ftmp\u002Fyoutube-music\"\nCAST_DIR=\"$HOME\u002F.youtube-music-cast\"\n```\n\n**Edit the file directly** or **re-run `cast-setup`** to update.\n\n## File Naming Best Practices\n\nKeep URLs clean. Simple filenames save you from headaches later.\n\n### The Problem\n\n❌ Bad filenames:\n```\nhttp:\u002F\u002F192.168.1.81:8735\u002FBonehead's%20Bank%20Holiday%20(Remastered).mp3\n```\nThis URL is messy, hard to type, and prone to encoding errors.\n\n### The Solution\n\n✅ Good filenames:\n```\nhttp:\u002F\u002F192.168.1.81:8735\u002Fboneheads-bank-holiday.mp3\n```\nClean, easy to type, no issues.\n\n### Practical Tips\n\n```bash\n# After download, rename immediately\nmv \"Oasis - Bonehead's Bank Holiday (Remastered 1995).mp3\" \\\n   \"oasis-boneheads-bank-holiday.mp3\"\n\n# Use lowercase, hyphens only\nmv \"My Awesome Song.mp3\" \"my-awesome-song.mp3\"\n\n# No special characters\nmv \"song@remix#.mp3\" \"song-remix.mp3\"\n```\n\n**Rule of thumb:**\n- Lowercase\n- Hyphens instead of spaces\n- No special characters (@, #, ?, etc.)\n- Keep it short\n\n## Troubleshooting\n\n### Chromecast Not in Home Assistant\n\n**Problem:** `cast-devices` shows no Chromecast devices.\n\n**Solution:** Add Google Cast integration\n1. Home Assistant → Settings → Devices & Services\n2. Click \"+ Add Integration\"\n3. Search \"Google Cast\" → Select it\n4. Follow the discovery wizard\n\n**If discovery fails:**\n- Ensure Chromecast and Home Assistant are on the same network\n- Try adding manually with Chromecast IP address\n\n### Server Won't Start\n\n**Problem:** `cast-server start` fails or says \"port in use\".\n\n**Solution:**\n```bash\n# Check if port 8735 is in use\nnetstat -tlnp | grep 8735\n# or\nss -tlnp | grep 8735\n\n# Stop any existing server\ncast-server stop\n\n# Try starting manually to see error\ncd \u002Ftmp\u002Fyoutube-music\npython3 -m http.server 8735\n```\n\n**If port is in use by another process:**\nEdit `~\u002F.youtube-music-cast\u002Fconfig.sh`:\n```bash\nSERVER_PORT=\"8736\"  # Change to something else\n```\n\n### \"File Not Found\" Error\n\n**Problem:** `cast-play song.mp3` says file not found.\n\n**Solution:**\n```bash\n# List what's actually there\ncast-list\n\n# Check exact spelling (case-sensitive!)\ncast-play \"Exact-Filename.mp3\"  # Not \"exact-filename.mp3\"\n\n# Verify server is running\ncast-server status\n```\n\n**Common mistakes:**\n- Wrong case: `Song.mp3` vs `song.mp3`\n- Wrong extension: `song.MP3` vs `song.mp3`\n- File in wrong directory: Check `DOWNLOAD_DIR` in config\n\n### Download Fails\n\n**Problem:** `cast-download` errors or hangs.\n\n**Solution:**\n```bash\n# Update yt-dlp (YouTube changes often)\npip install --upgrade yt-dlp\n\n# Check version\nyt-dlp --version\n\n# Try verbose output to see what's wrong\nyt-dlp --verbose \"URL\"\n\n# Try different URL format\n# YouTube: https:\u002F\u002Fyoutube.com\u002Fwatch?v=VIDEO_ID\n# YouTube Music: https:\u002F\u002Fmusic.youtube.com\u002Fwatch?v=VIDEO_ID\n```\n\n**If it's a geo-blocked video:**\nUse a VPN or find an alternative upload of the same track.\n\n### Home Assistant Connection Error\n\n**Problem:** `curl` errors when contacting HA.\n\n**Solution:**\n```bash\n# Test your HA token manually\ncurl -H \"Authorization: Bearer YOUR_TOKEN\" \\\n     -H \"Content-Type: application\u002Fjson\" \\\n     \"http:\u002F\u002Fhomeassistant.local:8123\u002Fapi\u002Fstates\"\n\n# If you see JSON → token is good\n# If 401 Unauthorized → token is wrong or expired\n# If connection refused → URL is wrong or HA is down\n```\n\n**Regenerate token if needed:**\nHA → Profile → Scroll down → Long-Lived Access Tokens → Generate new\n\n### Video Mode Issues\n\n**Problem:** `cast-download --video` fails with \"ffmpeg not found\" or similar error.\n\n**Solution:**\n```bash\n# Check if ffmpeg is installed\nffmpeg -version\n\n# If not found, install it\n# Debian\u002FUbuntu\nsudo apt install ffmpeg\n\n# macOS\nbrew install ffmpeg\n```\n\n**Problem:** Video creation is slow or takes too long.\n\n**Solution:**\n- Video encoding is CPU-intensive. First-time creation may take 10-30 seconds per song.\n- Use MP3 mode (`cast-download` without `--video`) for faster downloads.\n- Consider lowering video quality in the script (edit `cast-download` and change `-preset ultrafast` to `-preset fast` for better quality but slower encoding).\n\n**Problem:** Text overlay doesn't appear or looks wrong.\n\n**Solution:**\n- The script uses DejaVu Sans Bold font. If it's not installed, text won't appear.\n- Install the font:\n  ```bash\n  # Debian\u002FUbuntu\n  sudo apt install fonts-dejavu\n\n  # macOS (usually pre-installed)\n  ```\n- Or edit the script to use a different font path.\n\n**Problem:** Chromecast audio device plays video without visuals.\n\n**Solution:**\n- This is expected behavior. Audio-only Chromecast devices (Google Home Mini, Chromecast Audio) will play the audio track from MP4 files but cannot display video.\n- Use MP3 mode for audio-only devices to save bandwidth and storage.\n\n**Problem:** MP4 files are too large.\n\n**Solution:**\n- Videos are larger than MP3s (typically 2-3x the size).\n- Reduce video bitrate by editing `cast-download` and changing `-b:a 192k` to `-b:a 128k` for audio, or adjust video codec settings.\n- Use MP3 mode if storage is a concern.\n\n### Radio Mode Issues\n\n**Problem:** Radio mode downloads unrelated songs.\n\n**Solution:**\n- Radio mode searches YouTube using the artist name from the seed song.\n- Sometimes the search may return mixed results due to ambiguous artist names.\n- Try using a different seed song with a clearer artist name.\n- The `radio_` prefix makes it easy to identify and remove unwanted downloads.\n\n**Problem:** Radio mode doesn't find any related songs.\n\n**Solution:**\n- Ensure you have a stable internet connection.\n- Check that the seed song has proper metadata (title\u002Fuploader).\n- Try a different seed song — some videos have limited search results.\n- Increase the count with `--radio-count 10` to get more results.\n\n**Problem:** Related songs don't play in sequence automatically.\n\n**Solution:**\n- Radio mode downloads the songs but doesn't auto-play them in sequence.\n- You need to manually play each related song, or create a simple playlist script:\n  ```bash\n  # Play all radio songs in sequence\n  for file in \u002Ftmp\u002Fyoutube-music\u002Fradio_*.mp3; do\n      cast-play \"$(basename \"$file\")\"\n      sleep 5  # Wait between songs\n  done\n  ```\n\n### Cast Commands Hang\n\n**Problem:** `cast-play` doesn't return or music never starts.\n\n**Common causes:**\n1. **Media player is offline** — Check `cast-devices` for state\n2. **Server isn't accessible from HA** — Verify `SERVER_IP` in config matches current IP\n3. **Chromecast network issue** — Restart Chromecast\n4. **Wrong device ID** — Copy exact ID from `cast-devices` output\n\n**Quick fix:**\n```bash\n# Restart everything\ncast-server stop\ncast-server start\ncast-play song.mp3\n\n# Check device is online\ncast-devices\n\n# Try casting from HA UI to isolate issue\n```\n\n## Project Structure\n\n```\nyoutube-music-cast\u002F\n├── scripts\u002F\n│   ├── cast-setup      # Configuration wizard (interactive)\n│   ├── cast-download   # Download from YouTube (uses yt-dlp)\n│   ├── cast-server     # HTTP server manager (start\u002Fstop\u002Fstatus)\n│   ├── cast-play       # Cast to device (HA API)\n│   ├── cast-stop       # Stop playback\n│   ├── cast-status     # Player status query\n│   ├── cast-devices    # List all HA media players\n│   ├── cast-list       # List downloaded files\n│   └── cast-help       # Help documentation\n├── install.sh          # Installation script (--global, --help)\n├── SKILL.md           # This file (ClawdHub skill definition)\n├── README.md          # User-facing documentation\n├── CHANGELOG.md       # Version history\n├── LICENSE            # MIT license\n├── .gitignore        # Protects secrets and state\n└── .clawdhub\u002F\n    └── origin.json    # ClawdHub metadata\n\n~\u002F.youtube-music-cast\u002F\n└── config.sh         # Your configuration (don't commit to Git)\n\n\u002Ftmp\u002Fyoutube-music\u002F\n└── *.mp3            # Downloaded music files\n```\n\n## Requirements\n\n### yt-dlp (YouTube downloader)\n\n```bash\npip install yt-dlp\n```\n\n**Update regularly:** `pip install --upgrade yt-dlp`\n\n### Python 3 (HTTP server)\n\n```bash\n# Check version (usually pre-installed)\npython3 --version\n```\n\n### curl (HTTP client for HA API)\n\n```bash\n# Check version (usually pre-installed)\ncurl --version\n```\n\n### jq (JSON processor)\n\n```bash\n# Debian\u002FUbuntu\nsudo apt install jq\n\n# macOS\nbrew install jq\n```\n\n### ffmpeg (Video mode - optional)\n\nRequired for `--video` flag to create MP4 videos with album art and text overlays.\n\n```bash\n# Debian\u002FUbuntu\nsudo apt install ffmpeg\n\n# macOS\nbrew install ffmpeg\n```\n\n**Check installation:**\n```bash\nffmpeg -version\n```\n\n**Note:** Video mode is optional. If you only download MP3s, you don't need ffmpeg.\n\n## Performance Tips\n\n### 1. Batch Downloads\nDownload multiple tracks or entire playlists at once:\n```bash\n# Download playlist\nyt-dlp -x --audio-format mp3 --audio-quality 320K \\\n  -o \"\u002Ftmp\u002Fyoutube-music\u002F%(playlist_index)s-%(title)s.%(ext)s\" \\\n  \"https:\u002F\u002Fyoutube.com\u002Fplaylist?list=PLAYLIST_ID\"\n\n# Then cast them without waiting\ncast-play 01-song.mp3\ncast-play 02-song.mp3\ncast-play 03-song.mp3\n```\n\n### 2. Keep Server Running\nThe HTTP server is lightweight (~5MB RAM). No need to stop\u002Fstart between casts:\n```bash\n# Start once\ncast-server start\n\n# Cast as many songs as you want\ncast-play song1.mp3\ncast-play song2.mp3\n# ... etc\n```\n\n### 3. Use Default Device\nSet `DEFAULT_DEVICE` in config to avoid typing it every time:\n```bash\n# In ~\u002F.youtube-music-cast\u002Fconfig.sh\nDEFAULT_DEVICE=\"media_player.bedroom_display\"\n\n# Now just cast\ncast-play song.mp3  # Automatically uses bedroom_display\n```\n\n### 4. Clean Up Occasionally\nFiles in `\u002Ftmp\u002F` are cleared on reboot by design, but you can manually clean:\n```bash\n# List all files with sizes\ncast-list\n\n# Remove old files\nrm \u002Ftmp\u002Fyoutube-music\u002F*.mp3\n```\n\n### 5. WiFi Matters\nIf streaming glitches:\n- Move Chromecast to 5GHz WiFi\n- Reduce distance between Chromecast and server\n- Check for WiFi interference\n\n### 6. Alias Commands\nAdd shell aliases for faster access:\n```bash\n# Add to ~\u002F.bashrc or ~\u002F.zshrc\nalias cs='cast-server'\nalias cd='cast-download'\nalias cp='cast-play'\nalias cl='cast-list'\nalias cst='cast-status'\n\n# Now just type\ncs      # Start server\ncd URL   # Download\ncp song  # Cast\ncl       # List\n```\n\n## Notes\n\n- Files are stored in `\u002Ftmp\u002Fyoutube-music\u002F` — cleared on reboot (by design)\n- Web server runs in background, persists across sessions\n- Keep filenames simple: lowercase, hyphens, no spaces\u002Fspecial chars\n- Server and Chromecast must be on same network\n- HA token is stored locally in `config.sh` — **don't commit to Git**\n- Quality is 320K MP3 — good balance of quality and file size\n- No cloud services, no subscriptions, no tracking\n\n## Comparison: This vs Alternatives\n\n| Feature | YouTube Music Cast | Spotify Free | YouTube Premium |\n|---------|-------------------|----------------|-----------------|\n| Cost | Free | Free (with ads) | $13.99\u002Fmonth |\n| Ads | None | Yes, every few songs | None |\n| Offline | Yes, forever | No (premium only) | Yes, with limit |\n| Quality | 320K MP3 | 160K (variable) | Up to 1080p video |\n| Privacy | Local only | Cloud-based | Cloud-based |\n| Platform | Any Chromecast | Spotify Connect | YouTube apps |\n| Queue management | Manual | Built-in | Built-in |\n| Multi-room | Manual | Premium feature | No |\n\n**Bottom line:** If you value privacy, want to own your music, and don't need cloud features, this is for you.\n\n## License\n\nMIT License — use it, modify it, share it.\n\n---\n\n**Version:** 6.0.0\n**Author:** Wobo\n**License:** MIT\n",{"name":5,"author":23,"config":24,"license":14,"version":27,"category":28,"homepage":29,"keywords":30,"metadata":43,"requires":46,"triggers":52,"repository":58,"description":7,"user-invocable":59},"Wobo",{"stateDirs":25},[26],"~\u002F.youtube-music-cast","6.0.0","media","https:\u002F\u002Fgithub.com\u002Fclawdbot\u002Fskills",[31,32,33,34,35,36,37,38,39,40,41,42],"youtube","music","chromecast","home-assistant","cast","media-player","streaming","yt-dlp","google-cast","audio","mp3","free-music",{"clawdbot":44},{"emoji":45},"🎵",{"env":47,"bins":48},[],[38,49,50,51],"python3","curl","jq",[53,54,55,56,57],"play music","cast to chromecast","youtube music","download music","cast music","https:\u002F\u002Fgithub.com\u002Fclawdbot\u002Fskills\u002Ftree\u002Fmain\u002Fyoutube-music-cast",true,"main","54afe4b75ed2eb8f0feabb2f5b57dfa4bcbb3c44",".agents\u002Fskills\u002Fyoutube-music-cast","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal","https:\u002F\u002Fgithub.com\u002Fmeghal86","2026-05-17 14:11:28",{"source":8,"skillName":5,"commands":67,"prompt":77,"zipAvailable":59},[68,71,74],{"tool":69,"command":70},"npx","npx skills add meghal86\u002Fstacksignal --skill youtube-music-cast",{"tool":72,"command":73},"bunx","bunx skills add meghal86\u002Fstacksignal --skill youtube-music-cast",{"tool":75,"command":76},"pnpm","pnpm dlx skills add meghal86\u002Fstacksignal --skill youtube-music-cast","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fyoutube-music-cast\u002FSKILL.md",[79],{"path":80,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":83,"sourceHtmlUrl":84},"_meta.json","REFERENCE","参考文档",286,"https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fyoutube-music-cast\u002F_meta.json",[86,94,102,110,118,125],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":90,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":18},"01M78XH0FRP65NYEDHF2BT7NB1","zvukogram","Text-to-Speech via Zvukogram API with SSML support. Use when you need to generate speech from text, create podcasts, voice notifications, or work with audio. Supports speed control, stress marks, English word transcription, and audio fragment merging.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzvukogram\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzvukogram\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":98,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":18},"01M78XEND5ASXYB6MN8AQQGJAF","zohomail","Zoho Mail API integration with managed OAuth. Send, receive, and manage emails, folders, and labels.\nUse this skill when users want to send emails, read messages, manage folders, or work with email labels in Zoho Mail.\nFor other third party apps, use the api-gateway skill (https:\u002F\u002Fclawhub.ai\u002Fbyungkyu\u002Fapi-gateway).\nRequires network access and valid Maton API key.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzohomail\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzohomail\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":106,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":18},"01M78XEBBV3C6DRZFAJXP6RDKS","zoho-recruit","Zoho Recruit API integration with managed OAuth. Manage candidates, job openings, interviews, and recruitment workflows.\nUse this skill when users want to read, create, update, or search recruitment data like candidates, job openings, interviews, and applications in Zoho Recruit.\nFor other third party apps, use the api-gateway skill (https:\u002F\u002Fclawhub.ai\u002Fbyungkyu\u002Fapi-gateway).\nRequires network access and valid Maton API key.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-recruit\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-recruit\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":114,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":18},"01M78XE5CQG75DZWYSKGXFR99T","zoho-people","Zoho People API integration with managed OAuth. Manage employees, departments, designations, attendance, and leave.\nUse this skill when users want to read, create, update, or query HR data like employees, departments, designations, and forms in Zoho People.\nFor other third party apps, use the api-gateway skill (https:\u002F\u002Fclawhub.ai\u002Fbyungkyu\u002Fapi-gateway).\nRequires network access and valid Maton API key.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-people\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-people\u002FSKILL.md",[],[],{"skillNo":119,"name":120,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":121,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":18},"01M78XDZKMZAJYFJJFT7MR5ZN2","zoho-mail","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-mail\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-mail\u002FSKILL.md",[],[],{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":129,"sourceHtmlUrl":130,"categories":131,"keywords":132,"publishedAt":18},"01M78XDST8JK0WVDA1F3VPNWXD","zoho-inventory","Zoho Inventory API integration with managed OAuth. Manage items, sales orders, invoices, purchase orders, bills, contacts, and shipments.\nUse this skill when users want to read, create, update, or delete inventory items, sales orders, invoices, purchase orders, bills, or other inventory records in Zoho Inventory.\nFor other third party apps, use the api-gateway skill (https:\u002F\u002Fclawhub.ai\u002Fbyungkyu\u002Fapi-gateway).\nRequires network access and valid Maton API key.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-inventory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-inventory\u002FSKILL.md",[],[]]