Example #1
0
 def filter_products(self, data):
     list = []
     if not data: return list
     # Qobuz free tracks with invalid product id
     #blackid = ['0000020110926', '0000201011300', '0000020120220', '0000020120221']
     albumseen = {}
     for track in data['albums']['items']:
         json = track
         # json[u'composer'] = track['composer']
         json[u'interpreter'] = track['artist']['name']
         product = Node_product()
         product.set_data(json)
         id = product.get_id()
         #if id in blackid: product.is_special_purchase = True
         if id in albumseen: continue
         albumseen[id] = 1
         list.append(product)
     return list
Example #2
0
 def _build_down(self, xbmc_directory, lvl, flag = None, progress = None):
     data = qobuz.api.get_albums_from_artist(self.get_id(), qobuz.addon.getSetting('artistsearchlimit'))
     if not data:
         warn(self, "Cannot fetch albums for artist: " + self.get_label())
         return False
     try: 
         total = len(data['albums']['items'])
     except: 
         import pprint
         warn(self, pprint.pformat(data))
     count = 0
     for jproduct in data['albums']['items']:
         keys = ['artist', 'interpreter', 'composer','performer']
         for k in keys:
             try: 
                 if k in data['artist']: jproduct[k] = weakref.proxy(data['artist'][k])
             except: pass
         node = Node_product()
         node.set_data(jproduct)
         xbmc_directory.update(count, total, "Add album:" + node.get_label(), '')
         self.add_child(node)
         count += 1
     return True