Skip to content

Commit

Permalink
Made it possible to render the album art on the left side of the text. (
Browse files Browse the repository at this point in the history
#50)

Co-authored-by: Magnus Marthinsen <[email protected]>
Co-authored-by: Christopher Fenner <[email protected]>
  • Loading branch information
3 people committed Mar 7, 2023
1 parent 851dab2 commit 06fb0bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
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

0 comments on commit 06fb0bb

Please sign in to comment.