Skip to content

Commit 06fb0bb

Browse files
MagMar94Magnus MarthinsenCFenner
authored
Made it possible to render the album art on the left side of the text. (#50)
Co-authored-by: Magnus Marthinsen <magmar@online.no> Co-authored-by: Christopher Fenner <9592452+CFenner@users.noreply.github.com>
1 parent 851dab2 commit 06fb0bb

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

MMM-Sonos.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Module.register('MMM-Sonos', {
88
defaults: {
99
showStoppedRoom: true,
1010
showAlbumArt: true,
11+
albumArtLocation: 'right',
1112
showRoomName: true,
1213
animationSpeed: 1000,
1314
updateInterval: 0.5, // every 0.5 minutes
@@ -96,7 +97,10 @@ Module.register('MMM-Sonos', {
9697
return {
9798
flip: this.data.position.startsWith('left'),
9899
loaded: this.loaded,
99-
showAlbumArt: this.config.showAlbumArt,
100+
showAlbumArtRight:
101+
this.config.showAlbumArt && this.config.albumArtLocation !== 'left',
102+
showAlbumArtLeft:
103+
this.config.showAlbumArt && this.config.albumArtLocation === 'left',
100104
showRoomName: this.config.showRoomName,
101105
showStoppedRoom: this.config.showStoppedRoom,
102106
roomList: this.roomList,

MMM-Sonos.njk

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55
{% if room.state == 'PLAYING' or showStoppedRoom %}
66
<li>
77
<div>
8+
{% if showAlbumArtLeft %}
9+
<div class="art">
10+
<img src="{{ room.albumArt }}"/>
11+
</div>
12+
{% endif %}
813
<div class="name normal medium">
914
<div>{{ room.artist }}</div>
1015
<div>{{ room.track }}</div>
1116
</div>
12-
{% if showAlbumArt %}
17+
{% if showAlbumArtRight %}
1318
<div class="art">
1419
<img src="{{ room.albumArt }}"/>
1520
</div>

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ You also can set some options to hide different parts of the module.
5555
|---|---|---|
5656
|`showStoppedRoom`|Trigger the visualization of stopped rooms.|`true`|
5757
|`showAlbumArt`|Trigger the visualization of the album art.|`true`|
58+
|`albumArtLocation`|Specifies on which side of the text the album art is rendered. Possible values: `left`, `right`.|`right`|
5859
|`showRoomName`|Trigger the visualization of the room name.|`true`|
5960

6061
### Known Issues

0 commit comments

Comments
 (0)