Permalink
Browse files

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

* New button to show the album art (Issue #14)
  • Loading branch information...
1 parent cb18d7f commit be615c6410819d71067d90cc8f6eb9df4e6b50ec @peregrinogris committed Feb 19, 2011
Showing with 30 additions and 16 deletions.
  1. +30 −16 lib/main.js
View
46 lib/main.js
@@ -2,6 +2,7 @@ const widgets = require("widget");
const panels = require("panel");
const data = require("self").data;
const pageMod = require("page-mod");
+const notifications = require("notifications");
//Global Flags
var uiReady = false;
@@ -23,19 +24,25 @@ var gsPageMod = pageMod.PageMod({
height: 218
})
- let wgDisplaySong = widgets.Widget({
- label:"Currently Playing",
- content: (data.load('ui/songDisplay.html'))
- .replace('%SONG% - %ARTIST%', 'Not Playing'),
- width: 300,
- panel: panelAlbumArt
- ,
- onClick: function() {
- if(songsQueued) {
- this.panel.show();
+ let wgAlbumArt = widgets.Widget({
+ label:"Album Art",
+ content: '<img src="'+data.url('ui/icons/image_small.png') +
+ '" style="cursor:pointer;"/>',
+ width: 16,
+ panel: panelAlbumArt,
+ onClick: function() {
+ if(songsQueued) {
+ this.panel.show();
+ }
}
- }
- });
+ });
+
+ let wgDisplaySong = widgets.Widget({
+ label:"Currently Playing",
+ content: (data.load('ui/songDisplay.html'))
+ .replace('%SONG% - %ARTIST%', 'Not Playing'),
+ width: 300
+ });
let wgPreviousSong = widgets.Widget({
label:"Previous Song",
@@ -114,10 +121,17 @@ var gsPageMod = pageMod.PageMod({
wgDisplaySong.content = ((tplDisplay.replace('%SONG%', msg.song.SongName))
.replace('%ARTIST%', msg.song.ArtistName))
- panelAlbumArt.postMessage(
- msg.song.artPath + 'm' +
- ((msg.song.CoverArtFilename) ? msg.song.CoverArtFilename : 'default.png')
- );
+ let albumArtURL = msg.song.artPath + 'm' +
+ ((msg.song.CoverArtFilename) ? msg.song.CoverArtFilename : 'default.png');
+
+ panelAlbumArt.postMessage(albumArtURL);
+
+ notifications.notify({
+ title: 'Now Playing',
+ text: msg.song.SongName + '\n' + msg.song.ArtistName,
+ iconURL: albumArtURL
+ });
+
break;
case "stopped":

0 comments on commit be615c6

Please sign in to comment.