Browse the code

 

Differences between 230 and 231 on /.
Number of edited files: 2 (0 added, 0 deleted and 2 modified)
Revision 231

About 1 month and 2 days ago.

* Added the album total length in the view
* Fixed a bug that occured when the searching for a similar song fails (continuously repeat the last similar song)
Added file(s) Deleted file(s) Modified file(s)

 

Old New Code
169
169

                                        
170
170
        tree = self.get_xml(url)
171
171
        xml = tree.find('similartracks')
172
 
        songs = xml.findall('track')
 
172
        if xml is not None:
 
173
            songs = xml.findall('track')
173
174

                                        
174
 
        for song in songs:
175
 
            name = song.find('name')
176
 
            artist = song.find('artist').find('name')
177
 
            songs_list.append([artist.text, name.text])
 
175
            for song in songs:
 
176
                name = song.find('name')
 
177
                artist = song.find('artist').find('name')
 
178
                songs_list.append([artist.text, name.text])
178
179

                                        
179
 
        self.set_cached_data('similar-songs', [song_artist, song_title], songs_list)
180
 
        return songs_list
 
180
            self.set_cached_data('similar-songs', [song_artist, song_title], songs_list)
 
181
            return songs_list
 
182
        else:
 
183
            # No similar tracks
 
184
            return []
181
185

                                        
182
186
    def get_similar_artists(self, artist_name):
183
187
        """Get a list of similar artists."""
184
188

                                        

 

Old New Code
257
257
        year = album_obj.year
258
258
        genre = album_obj.genre
259
259

                                        
 
260
        length = 0
 
261
        for item in album_obj.tracks:
 
262
            length += item.length
 
263
        total_time = self.functions.human_length(length, True)
 
264

                                    
260
265
        glade_album = join(self.functions.datadir, 'glade', 'albumview.ui')
261
266
        box = gtk_builder()
262
267
        box.set_translation_domain('bluemindo')
265
270

                                        
266
271
        box.get_object('label_album').set_text(album)
267
272
        box.get_object('label_artist').set_text(artist)
268
 
        box.get_object('lbl_year').set_markup('<small>' + year + '</small>')
 
273
        box.get_object('lbl_year').set_markup('<small>' + year + ' - <i>' +
 
274
                                              total_time + '</i></small>')
269
275
        box.get_object('lbl_genre').set_markup('<small><b>' + genre +
270
276
                                               '</b></small>')
271
277

                                        
272
278