Merge lp:~mims-michael/nuvola-player/rdio-fix into lp:nuvola-player/2.5.x

Proposed by Michael Mims
Status: Merged
Approved by: Jiří Janoušek
Approved revision: 366
Merged at revision: 499
Proposed branch: lp:~mims-michael/nuvola-player/rdio-fix
Merge into: lp:nuvola-player/2.5.x
Diff against target: 144 lines (+12/-80)
2 files modified
data/nuvolaplayer/services/rdio/integration.js (+11/-79)
data/nuvolaplayer/services/rdio/metadata.conf (+1/-1)
To merge this branch: bzr merge lp:~mims-michael/nuvola-player/rdio-fix
Reviewer Review Type Date Requested Status
Jiří Janoušek Approve
StefanL Pending
Review via email: mp+114234@code.launchpad.net

Description of the change

The latest update to the rdio web interface (which occurred ~2 weeks ago) broke the metadata portion of the service integration for nuvola. Additionally, rdio only supports the newest interface now so there is no need for the implementation of two versions of interfaces in the integration. I also added support for ablum titles in the new interface, as they were not captured in the previous implmentation. Not sure if this should be pushed to the service maintainer or to Nuvola, but I'm trying here first.

To post a comment you must log in.
Revision history for this message
Jiří Janoušek (fenryxo) wrote :

Looks good for me. Waiting for a result of a Stefan's review.

review: Approve
Revision history for this message
Michael Mims (mims-michael) wrote :

I don't think this will address the issue in the attached bug. This is mainly a fix for the art, artist, song, album data binding.

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

You're right, thanks.

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

More than 30 days without response from the maintainer, so I'm considering it approved.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/nuvolaplayer/services/rdio/integration.js'
--- data/nuvolaplayer/services/rdio/integration.js 2012-03-28 22:13:54 +0000
+++ data/nuvolaplayer/services/rdio/integration.js 2012-07-10 17:01:21 +0000
@@ -41,23 +41,6 @@
4141
4242
43 /**43 /**
44 * Determine, which version of the ui is currently being used.
45 * @returns 0 for the old ui and 1 for the new ui
46 */
47 Integration.prototype.getUiVersion = function(){
48 var uiVersion;
49 try {
50 if (playbackControls == undefined) {
51 uiVersion = 0;
52 }
53 }
54 catch (e) {
55 uiVersion = 1;
56 }
57 return uiVersion;
58 }
59
60 /**
61 * Updates current playback state44 * Updates current playback state
62 */45 */
63 Integration.prototype.update = function(){46 Integration.prototype.update = function(){
@@ -72,26 +55,13 @@
72 var can_thumbs_up = false;55 var can_thumbs_up = false;
73 var can_thumbs_down = false;56 var can_thumbs_down = false;
74 var can_favorite = false;57 var can_favorite = false;
75 var uiVersion = this.getUiVersion();
76 58
77 try{59 try{
78 var album_art;60 var playingTrack = R.Services.Player.model.get("playingTrack").attributes;
79 var album;61 album_art = playingTrack.icon;
80 var artist;62 album = playingTrack.album;
81 var song;63 artist = playingTrack.artist;
8264 song = playingTrack.name;
83 if(uiVersion == 1){
84 album_art = document.getElementsByClassName("album_link")[0].getElementsByClassName("image")[0].src;
85 album = null;
86 artist = document.getElementsByClassName("artist truncated_line")[0].innerText;
87 song = document.getElementsByClassName("name truncated_line")[0].innerText;
88 }
89 else {
90 album_art = document.getElementById('playerNowPlayingImage').src;
91 album = document.getElementById('playerNowPlayingAlbum').firstChild.innerText;
92 artist = document.getElementById('playerNowPlayingArtist').firstChild.innerText;
93 song = document.getElementById('playerNowPlayingTitle').firstChild.innerText;
94 }
95 }65 }
96 catch(e){66 catch(e){
97 //~ console.debug("Unable to obtain song info: " + e.message);67 //~ console.debug("Unable to obtain song info: " + e.message);
@@ -100,14 +70,7 @@
100 try{70 try{
101 var state = Nuvola.STATE_NONE;71 var state = Nuvola.STATE_NONE;
10272
103 var rdiostate;73 var rdiostate = R.Services.Player.model.attributes.playState;//new
104 if(uiVersion == 1){
105 rdiostate = R.Services.Player.model.attributes.playState;//new
106 }
107 else {
108 rdiostate = player_model.playState;//old
109 }
110
11174
112 switch (rdiostate){75 switch (rdiostate){
113 case 0: state = Nuvola.STATE_PAUSED; break;76 case 0: state = Nuvola.STATE_PAUSED; break;
@@ -140,53 +103,22 @@
140 * @param cmd command to execute103 * @param cmd command to execute
141 */104 */
142 Integration.prototype.command = function(cmd){105 Integration.prototype.command = function(cmd){
143 uiVersion = this.getUiVersion();
144
145 try{106 try{
146 switch(cmd){107 switch(cmd){
147 case Nuvola.CMD_PLAY:108 case Nuvola.CMD_PLAY:
148 if(this.state != Nuvola.STATE_PLAYING){109 if(this.state != Nuvola.STATE_PLAYING) R.Services.Player.playPause();
149 if(uiVersion == 1){
150 document.getElementsByClassName("play_pause")[0].click();
151 }
152 else{
153 playbackControls.playPause();
154 }
155 }
156 break;110 break;
157 case Nuvola.CMD_PAUSE:111 case Nuvola.CMD_PAUSE:
158 if(this.state == Nuvola.STATE_PLAYING){112 if(this.state == Nuvola.STATE_PLAYING) R.Services.Player.playPause();
159 if(uiVersion == 1){
160 document.getElementsByClassName("play_pause")[0].click();
161 }
162 else{
163 playbackControls.playPause();
164 }
165 }
166 break;113 break;
167 case Nuvola.CMD_TOGGLE:114 case Nuvola.CMD_TOGGLE:
168 if(uiVersion == 1){115 R.Services.Player.playPause();
169 document.getElementsByClassName("play_pause")[0].click();
170 }
171 else{
172 playbackControls.playPause();
173 }
174 break;116 break;
175 case Nuvola.CMD_PREV_SONG:117 case Nuvola.CMD_PREV_SONG:
176 if(uiVersion == 1){118 R.Services.Player.previous();
177 document.getElementsByClassName("prev")[0].click();
178 }
179 else{
180 getPlayer()._previous();
181 }
182 break;119 break;
183 case Nuvola.CMD_NEXT_SONG:120 case Nuvola.CMD_NEXT_SONG:
184 if(uiVersion == 1){121 R.Services.Player.next();
185 document.getElementsByClassName("next")[0].click();
186 }
187 else{
188 getPlayer()._next();
189 }
190 break;122 break;
191 default:123 default:
192 // Other commands are not supported124 // Other commands are not supported
193125
=== modified file 'data/nuvolaplayer/services/rdio/metadata.conf'
--- data/nuvolaplayer/services/rdio/metadata.conf 2012-03-14 13:21:00 +0000
+++ data/nuvolaplayer/services/rdio/metadata.conf 2012-07-10 17:01:21 +0000
@@ -3,4 +3,4 @@
3sandbox_pattern = https?://((www\.)?rdio\.com/|ak.rdio\.com|)3sandbox_pattern = https?://((www\.)?rdio\.com/|ak.rdio\.com|)
4maintainer_name = Stefan Lohmaier 4maintainer_name = Stefan Lohmaier
5maintainer_link = https://launchpad.net/~stefan-lohmaier5maintainer_link = https://launchpad.net/~stefan-lohmaier
6version = 16version = 2

Subscribers

People subscribed via source and target branches