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

Subscribers

People subscribed via source and target branches