Esempio n. 1
0
 def getItems(self, id, type: Type):
     if type == Type.Playlist:
         msg, data = self.__getItems__('playlists/' + str(id) + "/items")
     elif type == Type.Album:
         msg, data = self.__getItems__('albums/' + str(id) + "/items")
     else:
         return "invalid Type!", None, None
     if msg is not None:
         return msg, None, None
     tracks = []
     videos = []
     for item in data:
         if item['type'] == 'track':
             tracks.append(dictToModel(item['item'], Track()))
         else:
             videos.append(dictToModel(item['item'], Video()))
     return msg, tracks, videos
Esempio n. 2
0
 def getTrack(self, id):
     msg, data = self.__get__('tracks/' + str(id))
     return msg, dictToModel(data, Track())