Merge lp:~minchal/nuvola-player/integration-deezer into lp:nuvola-player/2.5.x

Proposed by Michał Pawłowski
Status: Merged
Merged at revision: 584
Proposed branch: lp:~minchal/nuvola-player/integration-deezer
Merge into: lp:nuvola-player/2.5.x
Diff against target: 185 lines (+170/-0)
3 files modified
data/nuvolaplayer/services/deezer/description.html (+13/-0)
data/nuvolaplayer/services/deezer/integration.js (+149/-0)
data/nuvolaplayer/services/deezer/metadata.conf (+8/-0)
To merge this branch: bzr merge lp:~minchal/nuvola-player/integration-deezer
Reviewer Review Type Date Requested Status
Jiří Janoušek Approve
Review via email: mp+125904@code.launchpad.net
To post a comment you must log in.
574. By Michał Pawłowski

Added album art support in radio mode

Revision history for this message
Jiří Janoušek (fenryxo) wrote :

Well, I have finally some time for the review. First of all, some boring legal stuff.

data/nuvolaplayer/services/deezer/icon.png:
Is this icon your original work? Is the PNG format preferred form for modification or is it an exported image from GIMP/Inkscape? What is its license?

data/nuvolaplayer/services/deezer/integration.js:
You chose GNU GPL 3 for your work, whereas the main program of Nuvola Player is licensed under 2-Clause BSD license. Since the license of the main program is compatible with GNU GPL, I believe it's OK to use GPL-licensed integration scripts as described in the GPL FAQ (cited bellow). However, I'm not a lawyer and if my interpretation would be found invalid, all GPL-covered scripts would be removed from the project. Therefore, I would appreciate if you would relicense your work under 2-Clause BSD license.

"If the program dynamically links plug-ins, and they make function calls to each other and share data structures, we believe they form a single program, which must be treated as an extension of both the main program and the plug-ins. In order to use the GPL-covered plug-ins, the main program must be released under the GPL or a GPL-compatible free software license, and that the terms of the GPL must be followed when the main program is distributed for use with these plug-ins." http://www.gnu.org/licenses/gpl-faq.html#NFUseGPLPlugins

data/nuvolaplayer/services/deezer/metadata.conf:
You want your work to be distributed with Nuvola Player, but you didn't set maintainer_link to your Launchpad account. It's mandatory condition.

"maintainer_link - link to page with contact to maintainer (including http:// or https://) or email address prefixed by mailto:. If you want to have your service integration shipped with Nuvola Player, you must use link to your Launchpad profile." http://nuvolaplayer.fenryxo.cz/contribute/development/service_integration.html

Finally, code review: Great, no fixes necessary.

review: Needs Information
575. By Michał Pawłowski

legal stuff

Revision history for this message
Michał Pawłowski (minchal) wrote :

data/nuvolaplayer/services/deezer/icon.png:
I made it quickly from /usr/share/nuvolaplayer/services/grooveshark/icon.png
and http://www.deezer.com/favicon.ico, so I don't know what is its license. I have not saved source file from GIMP.

data/nuvolaplayer/services/deezer/integration.js:
I copied file header form grooveshark/integration.js. Ofcourse, it can be BSD license. I made commit with new header to repo.

data/nuvolaplayer/services/deezer/metadata.conf:
fixed.

Revision history for this message
Jiří Janoušek (fenryxo) wrote :

> data/nuvolaplayer/services/deezer/icon.png:
> I made it quickly from /usr/share/nuvolaplayer/services/grooveshark/icon.png
> and http://www.deezer.com/favicon.ico, so I don't know what is its license. I have not saved source file from GIMP.

I cannot accept files with unclear copyright and license information,
so the icon has to be removed. I'll ask Alexander King - author of
other service icons - to create a new icon for Deezer then.

  review needs-fixing

review: Needs Fixing
Revision history for this message
Jiří Janoušek (fenryxo) wrote :

Could you remove data/nuvolaplayer/services/deezer/icon.png so I can merge your branch?

576. By Michał Pawłowski

removed icon

Revision history for this message
Jiří Janoušek (fenryxo) wrote :

Thanks for your work. I suggest you to subscribe to Nuvola Player Develompment mailing list to be notified about changes in Nuvola Player API and other announcements related to development.

https://launchpad.net/~nuvola-player-devel

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'data/nuvolaplayer/services/deezer'
2=== added file 'data/nuvolaplayer/services/deezer/description.html'
3--- data/nuvolaplayer/services/deezer/description.html 1970-01-01 00:00:00 +0000
4+++ data/nuvolaplayer/services/deezer/description.html 2012-10-13 12:01:22 +0000
5@@ -0,0 +1,13 @@
6+<div id="thumbnails">
7+
8+</div>
9+<p><strong>Deezer</strong> is a French web-based music streaming service.
10+It allows users to listen to music on various devices online or offline.
11+It currently has 18 million licensed tracks, over 30,000 radio channels
12+and 22 million users (1.5 million subscribers).
13+</p>
14+<p style="text-align: center">
15+<em>Source:
16+<a href="http://en.wikipedia.org/wiki/Deezer">Grooveshark on Wikipedia</a>,
17+<a href="http://deezer.com">Official website</a></em>
18+</p>
19
20=== added file 'data/nuvolaplayer/services/deezer/integration.js'
21--- data/nuvolaplayer/services/deezer/integration.js 1970-01-01 00:00:00 +0000
22+++ data/nuvolaplayer/services/deezer/integration.js 2012-10-13 12:01:22 +0000
23@@ -0,0 +1,149 @@
24+/**
25+ * Nuvola Player :: Deezer integration
26+ *
27+ * This script uses jQuery, that is already included on Deezer website.
28+ *
29+ * Copyright 2012 Michał Pawłowski <michal@pawlowski.be>
30+ *
31+ * Redistribution and use in source and binary forms, with or without
32+ * modification, are permitted provided that the following conditions are met:
33+ *
34+ * 1. Redistributions of source code must retain the above copyright notice, this
35+ * list of conditions and the following disclaimer.
36+ * 2. Redistributions in binary form must reproduce the above copyright notice,
37+ * this list of conditions and the following disclaimer in the documentation
38+ * and/or other materials provided with the distribution.
39+ *
40+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
41+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
42+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
43+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
44+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
45+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
47+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
48+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
49+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50+ */
51+
52+/* Anonymous function is used not to pollute environment */
53+(function(Nuvola){
54+ var Integration = function(){
55+ this.name = "deezer";
56+ this.can_thumbs_down = null;
57+ this.can_prev = null;
58+ this.can_next = null;
59+ this.last_art = null;
60+ this.last_song = null;
61+ this.update();
62+ Nuvola.onMessageReceived = Nuvola.bind(this, this.messageHandler);
63+ };
64+
65+ Integration.prototype.update = function() {
66+ var state = Nuvola.STATE_NONE;
67+ var can_prev;
68+ var can_next;
69+ var can_thumbs_down;
70+
71+ try{
72+ var play = $('#h_play a');
73+ var pause = $('#h_pause a');
74+
75+ if (play.is(':visible')) {
76+ state = Nuvola.STATE_PAUSED;
77+ } else if (pause.is(':visible')) {
78+ state = Nuvola.STATE_PLAYING;
79+ }
80+
81+ if(state != Nuvola.STATE_NONE){
82+ can_prev = !$('#h_previous a').hasClass('disabled');
83+ can_next = !$('#h_next a').hasClass('disabled');
84+
85+ var td_btn = $('#like_track.bad-song');
86+ can_thumbs_down = td_btn.length>0 && td_btn.is(':visible');
87+ } else{
88+ can_prev = can_next = can_thumbs_down = false;
89+ }
90+
91+ } catch(e){
92+ state = Nuvola.STATE_NONE;
93+ can_prev = can_next = can_thumbs_down = false;
94+ }
95+
96+ var song = $('#current-track').text();
97+ var artist = $('#current-artist').text();
98+ var last_song = song + '-' + artist;
99+
100+ // album art - only on radio mode
101+ // remembered to next song change, when user changes tabs
102+ // in main menu, album art shouldn't change to null
103+ if (this.last_song != last_song) {
104+ this.last_art = null;
105+ }
106+
107+ this.last_song = last_song;
108+
109+ try {
110+ var img = $('#radio_thumbs li img').first();
111+
112+ if (img.length) {
113+ this.last_art = img.attr('src');
114+ }
115+ } catch (e) {}
116+
117+ // Submit data to Nuvola backend
118+ Nuvola.updateSong(song, artist, null, this.last_art, state);
119+
120+ // Update actions (previous song, next song)
121+ if(this.can_prev !== can_prev){
122+ this.can_prev = can_prev;
123+ Nuvola.updateAction(Nuvola.ACTION_PREV_SONG, can_prev);
124+ }
125+ if(this.can_next !== can_next){
126+ this.can_next = can_next;
127+ Nuvola.updateAction(Nuvola.ACTION_NEXT_SONG, can_next);
128+ }
129+ if(this.can_thumbs_down !== can_thumbs_down){
130+ this.can_thumbs_down = can_thumbs_down;
131+ Nuvola.updateAction(Nuvola.ACTION_THUMBS_DOWN, can_thumbs_down);
132+ }
133+
134+ setTimeout(Nuvola.bind(this, this.update), 1000);
135+ }
136+
137+ Integration.prototype.messageHandler = function(message) {
138+ try {
139+ switch(message){
140+ case Nuvola.ACTION_TOGGLE_PLAY:
141+ if ($('#h_play a').is(':visible')) {
142+ window.playercontrol.doAction('play');
143+ } else {
144+ window.playercontrol.doAction('pause');
145+ }
146+ break;
147+ case Nuvola.ACTION_PLAY:
148+ window.playercontrol.doAction('play');
149+ break;
150+ case Nuvola.ACTION_PAUSE:
151+ window.playercontrol.doAction('pause');
152+ break;
153+ case Nuvola.ACTION_PREV_SONG:
154+ window.playercontrol.doAction('prev');
155+ break;
156+ case Nuvola.ACTION_NEXT_SONG:
157+ window.playercontrol.doAction('next');
158+ break;
159+ case Nuvola.ACTION_THUMBS_DOWN:
160+ window.playercontrol.doAction('smartNotLike');
161+ break;
162+ default:
163+ // Other commands are not supported
164+ throw {"message": "Not supported."};
165+ }
166+ } catch(e){
167+ throw (this.name + ": " + e.message);
168+ }
169+ }
170+
171+ Nuvola.integration = new Integration(); // Singleton
172+})(this);
173
174=== added file 'data/nuvolaplayer/services/deezer/metadata.conf'
175--- data/nuvolaplayer/services/deezer/metadata.conf 1970-01-01 00:00:00 +0000
176+++ data/nuvolaplayer/services/deezer/metadata.conf 2012-10-13 12:01:22 +0000
177@@ -0,0 +1,8 @@
178+name = Deezer
179+home_page = http://www.deezer.com
180+sandbox_pattern = https?://[A-Za-z0-9_-]*\.deezer.com/
181+maintainer_name = Michał Pawłowski
182+maintainer_link = https://launchpad.net/~minchal
183+version = 1
184+flash_plugin = yes
185+api_major = 2

Subscribers

People subscribed via source and target branches