Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Music Assistant Jukebox Integration
# <img src="logo.png" width="25" height="25"> Music Assistant Jukebox Integration

A Home Assistant integration that provides a web-based song request system that integrates with Music Assistant to create an interactive jukebox experience for guests!

![Jukebox Interface](https://github.com/DanStennett/HAMusicAssistantJukebox/blob/main/readme_image.jpg?raw=true)
![Jukebox Interface](showcase.avifs)

## Features
- Real-time song search across all connected Music Assistant providers
Expand All @@ -24,6 +24,9 @@ Before installing this integration, make sure you have:
## Installation

### HACS (Recommended)
[![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=DJS91&repository=HAMusicAssistantJukebox&category=Integration)

or
1. Add this repository to HACS as a custom repository
- HACS > Menu > Custom repositories
- URL: `https://github.com/DJS91/HAMusicAssistantJukebox`
Expand Down Expand Up @@ -88,13 +91,3 @@ To use the blueprint:
4. Configure:
- Media Player: Select your Music Assistant media player
- Default Playlist: Enter the name of your fallback playlist

## Contributing
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CONTRIBUTING.md already present


Feel free to contribute! Open an issue or submit a PR.

## Credits
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already present in the sidebar, better to leave them there so you don't have to update the readme every time


Based on the original [HAMusicAssistantJukebox](https://github.com/DJS91/HAMusicAssistantJukebox) by DJS91.
Integration developed by @DJS91 and @TheOddPirate.

15 changes: 11 additions & 4 deletions custom_components/music_assistant_jukebox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
HTML_FILE,
BLUEPRINT_FILE,
CONF_MEDIA_PLAYER,
CONF_MUSIC_ASSISTANT_ID,
BG_FILE
CONF_MUSIC_ASSISTANT_ID
)
PLATFORMS: list[Platform] = [Platform.SWITCH, Platform.NUMBER, Platform.IMAGE]

Expand Down Expand Up @@ -106,7 +105,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

# Define files to copy including blueprint
files_to_copy = {
"bg.jpg": BG_FILE,
"jukebox.html": HTML_FILE,
"jukebox_controller.yaml": BLUEPRINT_FILE
}
Expand All @@ -124,7 +122,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
else:
LOGGER.error("Source file %s not found", src_file)

# Update jukebox.html with correct valuesMore actions
# Copy media folder if it exists
media_src = original_path / "media"
media_dst = www_path / "media"
if media_src.exists() and media_src.is_dir():
if media_dst.exists():
shutil.rmtree(media_dst)
shutil.copytree(media_src, media_dst)
LOGGER.info("Copied media folder to %s", media_dst)

# Update jukebox.html with correct values
html_file = Path(hass.config.path(HTML_FILE))
if html_file.exists():
async with aiofiles.open(html_file, mode='r') as file:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/music_assistant_jukebox/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
WWW_JUKEBOX_DIR = "www/jukebox"
TOKEN_FILE = f"{WWW_JUKEBOX_DIR}/jukeboxtoken.key"
HTML_FILE = f"{WWW_JUKEBOX_DIR}/jukebox.html"
BG_FILE = f"{WWW_JUKEBOX_DIR}/bg.jpg"
MEDIA_FOLDER = f"{WWW_JUKEBOX_DIR}/media"
BLUEPRINT_FILE = "blueprints/automation/music_assistant_jukebox/jukebox_controller.yaml"
Loading