Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix #53 Album Art not working

Fix #52 Buffered progress bar not working
Fix #51 Song title not updating
Fix #50 GSRC 0.3.2 breaks Grooveshark seek bar
  • Loading branch information...
commit fbb6bd42579a8b7ab56568f58b2f12173e019f49 1 parent 197845b
@peregrinogris authored
Showing with 50 additions and 38 deletions.
  1. +2 −1  data/pageMod.js
  2. +48 −37 lib/main.js
View
3  data/pageMod.js
@@ -30,7 +30,7 @@ try{
// scope, so it doesn't have access to content scripts functions.
// Except if we explicitely expose one, like gsrc_progressListener
GS.player.player.setPlaybackStatusCallback(
- "function(b){GS.Controllers.PlayerController.instance().playerStatus(b); gsrc_progressListener(b);}"
+ "gsrc_progressListener"
);
wireTapped = true;
}
@@ -44,6 +44,7 @@ try{
// Expose this function to document scope as we register it before with
// `setPlaybackStatusCallback`
unsafeWindow.gsrc_progressListener = function progressListener(event){
+ GS.Controllers.PlayerController.instance().playerStatus(event);
self.port.emit("songProgress", {
"position": Math.ceil(event.position/event.duration*100),
"buffered": Math.ceil(event.bytesLoaded/event.bytesTotal*100)
View
85 lib/main.js
@@ -26,35 +26,35 @@ var gsPageMod = pageMod.PageMod({
contentScriptFile: data.url('pageMod.js'),
onAttach: function onAttach(worker, mod) {
if(!uiReady) {
- let panelAlbumArt = panels.Panel({
- contentURL: data.url('ui/albumArt.html'),
- contentScriptFile: data.url('ui/albumArt.js'),
- width: 222,
- height: 222
- })
-
- let wgAlbumArt = widgets.Widget({
- label:"Album Art",
- id: 'wgAlbumArt',
- content: '<img src="'+data.url('ui/icons/image.png') +
+ let panelAlbumArt = panels.Panel({
+ contentURL: data.url('ui/albumArt.html'),
+ contentScriptFile: data.url('ui/albumArt.js'),
+ width: 222,
+ height: 222
+ })
+
+ let wgAlbumArt = widgets.Widget({
+ label:"Album Art",
+ id: 'wgAlbumArt',
+ content: '<img src="'+data.url('ui/icons/image.png') +
'" style="cursor:pointer;"/>',
- width: 16,
- panel: panelAlbumArt,
- onClick: function() {
- if(songsQueued) {
- this.panel.show();
- }
+ width: 16,
+ panel: panelAlbumArt,
+ onClick: function() {
+ if(songsQueued) {
+ this.panel.show();
}
- });
+ }
+ });
- let wgDisplaySong = widgets.Widget({
- label:"Currently Playing",
- id: 'wgDisplaySong',
- contentURL: data.url('ui/songDisplay.html'),
- contentScriptFile: data.url('ui/songDisplay.js'),
- contentScriptWhen: 'ready',
- width: 300
- });
+ let wgDisplaySong = widgets.Widget({
+ label:"Currently Playing",
+ id: 'wgDisplaySong',
+ contentURL: data.url('ui/songDisplay.html'),
+ contentScriptFile: data.url('ui/songDisplay.js'),
+ contentScriptWhen: 'ready',
+ width: 300
+ });
let wgPreviousSong = widgets.Widget({
label:"Previous Song",
@@ -68,12 +68,13 @@ var gsPageMod = pageMod.PageMod({
label:"Play Song",
id: 'wgPlayPauseSong',
content: '<img src="'+data.url('ui/icons/control.png') +
- '" style="cursor:pointer;"/>',
+ '" style="cursor:pointer;"/>',
onClick: function(){
if(!musicPlaying) {
if(songsQueued) {
worker.port.emit('play')
- this.content = '<img src="'+data.url('ui/icons/control-pause.png') +
+ this.content = '<img src="' +
+ data.url('ui/icons/control-pause.png') +
'" style="cursor:pointer;"/>';
this.tooltip = "Pause Song";
musicPlaying = true;
@@ -117,7 +118,7 @@ var gsPageMod = pageMod.PageMod({
label:"Grooveshark Remote Control Settings",
id: 'wgSettings',
content: '<img src="'+data.url('ui/icons/equalizer.png') +
- '" style="cursor:pointer;"/>',
+ '" style="cursor:pointer;"/>',
width: 16,
panel: panelSettings
});
@@ -136,17 +137,27 @@ var gsPageMod = pageMod.PageMod({
worker.port.on("nowPlaying", function (msg) {
musicPlaying = true;
songsQueued = true;
- wgPlayPauseSong.content = '<img src="'+data.url('ui/icons/control-pause.png') +
- '" style="cursor:pointer;"/>';
+ wgPlayPauseSong.content = '<img src="' +
+ data.url('ui/icons/control-pause.png') +
+ '" style="cursor:pointer;"/>';
wgPlayPauseSong.tooltip = "Pause Song";
wgDisplaySong.port.emit("nowPlaying", msg);
- let albumArtURL = msg.song.artPath + 'm' +
- ((msg.song.CoverArtFilename) ? msg.song.CoverArtFilename : 'default.png');
-
- let albumThumbURL = msg.song.artPath + 't' +
- ((msg.song.CoverArtFilename) ? msg.song.CoverArtFilename : 'default.png');
+ msg.song.artPath = 'http://images.grooveshark.com/static/albums/';
+ let albumArtURL = msg.song.artPath + '200_' +
+ (
+ (msg.song.CoverArtFilename)
+ ? msg.song.CoverArtFilename
+ : 'default.png'
+ );
+
+ let albumThumbURL = msg.song.artPath + '50_' +
+ (
+ (msg.song.CoverArtFilename)
+ ? msg.song.CoverArtFilename
+ : 'default.png'
+ );
panelAlbumArt.port.emit("album", albumArtURL);
@@ -178,4 +189,4 @@ var gsPageMod = pageMod.PageMod({
//Developing shortcut
-//require("tabs").activeTab.url = 'http://grooveshark.com';
+require("tabs").activeTab.url = 'http://grooveshark.com';
Please sign in to comment.
Something went wrong with that request. Please try again.