Example #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
Example #2
0
 def getVideo(self, id):
     msg, data = self.__get__('videos/' + str(id))
     return msg, dictToModel(data, Video())