Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made it possible to render the album art on the left side of the text. #50

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion MMM-Sonos.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Module.register('MMM-Sonos', {
defaults: {
showStoppedRoom: true,
showAlbumArt: true,
albumArtLocation: 'right',
showRoomName: true,
animationSpeed: 1000,
updateInterval: 0.5, // every 0.5 minutes
Expand Down Expand Up @@ -96,7 +97,10 @@ Module.register('MMM-Sonos', {
return {
flip: this.data.position.startsWith('left'),
loaded: this.loaded,
showAlbumArt: this.config.showAlbumArt,
showAlbumArtRight:
this.config.showAlbumArt && this.config.albumArtLocation !== 'left',
showAlbumArtLeft:
this.config.showAlbumArt && this.config.albumArtLocation === 'left',
showRoomName: this.config.showRoomName,
showStoppedRoom: this.config.showStoppedRoom,
roomList: this.roomList,
Expand Down
7 changes: 6 additions & 1 deletion MMM-Sonos.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
{% if room.state == 'PLAYING' or showStoppedRoom %}
<li>
<div>
{% if showAlbumArtLeft %}
<div class="art">
<img src="{{ room.albumArt }}"/>
</div>
{% endif %}
<div class="name normal medium">
<div>{{ room.artist }}</div>
<div>{{ room.track }}</div>
</div>
{% if showAlbumArt %}
{% if showAlbumArtRight %}
<div class="art">
<img src="{{ room.albumArt }}"/>
</div>
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ You also can set some options to hide different parts of the module.
|---|---|---|
|`showStoppedRoom`|Trigger the visualization of stopped rooms.|`true`|
|`showAlbumArt`|Trigger the visualization of the album art.|`true`|
|`albumArtLocation`|Specifies on which side of the text the album art is rendered. Possible values: `left`, `right`.|`right`|
|`showRoomName`|Trigger the visualization of the room name.|`true`|

### Known Issues
Expand Down