Skip to content
This repository
Browse code

* Added toaster-like notifications on song start (Issue #13)

* New button to show the album art (Issue #14)
  • Loading branch information...
commit be615c6410819d71067d90cc8f6eb9df4e6b50ec 1 parent cb18d7f
Hernán Rodríguez Colmeiro authored

Showing 1 changed file with 30 additions and 16 deletions. Show diff stats Hide diff stats

  1. +30 16 lib/main.js
46 lib/main.js
@@ -2,6 +2,7 @@ const widgets = require("widget");
2 2 const panels = require("panel");
3 3 const data = require("self").data;
4 4 const pageMod = require("page-mod");
  5 +const notifications = require("notifications");
5 6
6 7 //Global Flags
7 8 var uiReady = false;
@@ -23,19 +24,25 @@ var gsPageMod = pageMod.PageMod({
23 24 height: 218
24 25 })
25 26
26   - let wgDisplaySong = widgets.Widget({
27   - label:"Currently Playing",
28   - content: (data.load('ui/songDisplay.html'))
29   - .replace('%SONG% - %ARTIST%', 'Not Playing'),
30   - width: 300,
31   - panel: panelAlbumArt
32   - ,
33   - onClick: function() {
34   - if(songsQueued) {
35   - this.panel.show();
  27 + let wgAlbumArt = widgets.Widget({
  28 + label:"Album Art",
  29 + content: '<img src="'+data.url('ui/icons/image_small.png') +
  30 + '" style="cursor:pointer;"/>',
  31 + width: 16,
  32 + panel: panelAlbumArt,
  33 + onClick: function() {
  34 + if(songsQueued) {
  35 + this.panel.show();
  36 + }
36 37 }
37   - }
38   - });
  38 + });
  39 +
  40 + let wgDisplaySong = widgets.Widget({
  41 + label:"Currently Playing",
  42 + content: (data.load('ui/songDisplay.html'))
  43 + .replace('%SONG% - %ARTIST%', 'Not Playing'),
  44 + width: 300
  45 + });
39 46
40 47 let wgPreviousSong = widgets.Widget({
41 48 label:"Previous Song",
@@ -114,10 +121,17 @@ var gsPageMod = pageMod.PageMod({
114 121 wgDisplaySong.content = ((tplDisplay.replace('%SONG%', msg.song.SongName))
115 122 .replace('%ARTIST%', msg.song.ArtistName))
116 123
117   - panelAlbumArt.postMessage(
118   - msg.song.artPath + 'm' +
119   - ((msg.song.CoverArtFilename) ? msg.song.CoverArtFilename : 'default.png')
120   - );
  124 + let albumArtURL = msg.song.artPath + 'm' +
  125 + ((msg.song.CoverArtFilename) ? msg.song.CoverArtFilename : 'default.png');
  126 +
  127 + panelAlbumArt.postMessage(albumArtURL);
  128 +
  129 + notifications.notify({
  130 + title: 'Now Playing',
  131 + text: msg.song.SongName + '\n' + msg.song.ArtistName,
  132 + iconURL: albumArtURL
  133 + });
  134 +
121 135 break;
122 136
123 137 case "stopped":

0 comments on commit be615c6

Please sign in to comment.
Something went wrong with that request. Please try again.