nuvola-player-devel team mailing list archive
-
nuvola-player-devel team
-
Mailing list archive
-
Message #00044
[Merge] lp:~minchal/nuvola-player/integration-deezer into lp:nuvola-player
Michał P. has proposed merging lp:~minchal/nuvola-player/integration-deezer into lp:nuvola-player.
Requested reviews:
Jiří Janoušek (fenryxo)
For more details, see:
https://code.launchpad.net/~minchal/nuvola-player/integration-deezer/+merge/125904
--
https://code.launchpad.net/~minchal/nuvola-player/integration-deezer/+merge/125904
Your team Nuvola Player Development is subscribed to branch lp:nuvola-player.
=== added directory 'data/nuvolaplayer/services/deezer'
=== added file 'data/nuvolaplayer/services/deezer/description.html'
--- data/nuvolaplayer/services/deezer/description.html 1970-01-01 00:00:00 +0000
+++ data/nuvolaplayer/services/deezer/description.html 2012-09-23 22:47:19 +0000
@@ -0,0 +1,13 @@
+<div id="thumbnails">
+
+</div>
+<p><strong>Deezer</strong> is a French web-based music streaming service.
+It allows users to listen to music on various devices online or offline.
+It currently has 18 million licensed tracks, over 30,000 radio channels
+and 22 million users (1.5 million subscribers).
+</p>
+<p style="text-align: center">
+<em>Source:
+<a href="http://en.wikipedia.org/wiki/Deezer";>Grooveshark on Wikipedia</a>,
+<a href="http://deezer.com";>Official website</a></em>
+</p>
=== added file 'data/nuvolaplayer/services/deezer/icon.png'
Binary files data/nuvolaplayer/services/deezer/icon.png 1970-01-01 00:00:00 +0000 and data/nuvolaplayer/services/deezer/icon.png 2012-09-23 22:47:19 +0000 differ
=== added file 'data/nuvolaplayer/services/deezer/integration.js'
--- data/nuvolaplayer/services/deezer/integration.js 1970-01-01 00:00:00 +0000
+++ data/nuvolaplayer/services/deezer/integration.js 2012-09-23 22:47:19 +0000
@@ -0,0 +1,113 @@
+/*
+ Nuvola Player :: Deezer integration
+
+ This script uses jQuery, that is already included on Deezer website.
+
+ Copyright 2012 Michał Pawłowski <michal@xxxxxxxxxxxx>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/* Anonymous function is used not to pollute environment */
+(function(Nuvola){
+ var Integration = function(){
+ this.name = "deezer";
+ this.state = Nuvola.STATE_NONE;
+ this.can_thumbs_up = null;
+ this.can_thumbs_down = null;
+ this.can_prev = null;
+ this.can_next = null;
+ this.update();
+ Nuvola.onMessageReceived = Nuvola.bind(this, this.messageHandler);
+ };
+
+ Integration.prototype.update = function() {
+ var state;
+ var can_prev;
+ var can_nex;
+
+ try{
+ var play = $('#h_play a');
+ var pause = $('#h_pause a');
+
+ if (play.is(':visible')) {
+ state = Nuvola.STATE_PAUSED;
+ } else if (pause.is(':visible')) {
+ state = Nuvola.STATE_PLAYING;
+ }
+
+ if(state != Nuvola.STATE_NONE){
+ can_prev = !$('#h_previous a').hasClass('disabled');
+ can_next = !$('#h_next a').hasClass('disabled');
+ } else{
+ can_prev = can_next = false;
+ }
+
+ } catch(e){
+ state = Nuvola.STATE_NONE;
+ can_prev = can_next = false;
+ }
+
+ // Submit data to Nuvola backend
+ Nuvola.updateSong(
+ $('#current-track').text(), $('#current-artist').text(),
+ null, null,
+ state
+ );
+
+ // Update actions (previous song, next song)
+ if(this.can_prev !== can_prev){
+ this.can_prev = can_prev;
+ Nuvola.updateAction(Nuvola.ACTION_PREV_SONG, can_prev);
+ }
+ if(this.can_next !== can_next){
+ this.can_next = can_next;
+ Nuvola.updateAction(Nuvola.ACTION_NEXT_SONG, can_next);
+ }
+
+ setTimeout(Nuvola.bind(this, this.update), 500);
+ }
+
+ Integration.prototype.messageHandler = function(message) {
+ try {
+ switch(message){
+ case Nuvola.ACTION_TOGGLE_PLAY:
+ if ($('#h_play a').is(':visible')) {
+ window.playercontrol.doAction('play');
+ } else {
+ window.playercontrol.doAction('pause');
+ }
+ break;
+ case Nuvola.ACTION_PLAY:
+ window.playercontrol.doAction('play');
+ break;
+ case Nuvola.ACTION_PAUSE:
+ window.playercontrol.doAction('pause');
+ break;
+ case Nuvola.ACTION_PREV_SONG:
+ window.playercontrol.doAction('prev');
+ break;
+ case Nuvola.ACTION_NEXT_SONG:
+ window.playercontrol.doAction('next');
+ break;
+ default:
+ // Other commands are not supported
+ throw {"message": "Not supported."};
+ }
+ } catch(e){
+ throw (this.name + ": " + e.message);
+ }
+ }
+
+ Nuvola.integration = new Integration(); // Singleton
+})(this);
=== added file 'data/nuvolaplayer/services/deezer/metadata.conf'
--- data/nuvolaplayer/services/deezer/metadata.conf 1970-01-01 00:00:00 +0000
+++ data/nuvolaplayer/services/deezer/metadata.conf 2012-09-23 22:47:19 +0000
@@ -0,0 +1,8 @@
+name = Deezer
+home_page = http://www.deezer.com
+sandbox_pattern = https?://[A-Za-z0-9_-]*\.deezer.com/
+maintainer_name = Michał Pawłowski
+maintainer_link = http://pawlowski.be
+version = 1
+flash_plugin = yes
+api_major = 2
Follow ups