def test_playlist_del_tracks(app, playlist, user): track_ids = ",".join( [str(t["id"]) for t in playlist_get_tracks_json["tracks"]["items"]]) with responses.RequestsMock() as response_mock: response_mock.add( responses.GET, get_url( playlist_id=playlist_add_tracks_json["id"], user_auth_token=user.auth_token, track_ids=track_ids, ), json={"status": "success"}, status=200, match_querystring=True, ) tracks = [ qobuz.Track(t) for t in playlist_get_tracks_json["tracks"]["items"] ] # Match playlist-ids to add to the correct id playlist.id = playlist_add_tracks_json["id"] playlist.del_tracks(tracks, user)
def get_all_tracks(self, offset=0, limit=50): res = qobuz.api.request( "artist/get", artist_id=self.id, extra="tracks", offset=offset, limit=limit, ) return [qobuz.Track(t) for t in res["tracks"]["items"]]
def test_track_init(app): track_item = track_search_json["tracks"]["items"][0] track = qobuz.Track(track_item) assert track.id == track_item["id"] assert track.title == track_item["title"] assert track.album == qobuz.Album(track_item["album"]) assert track.duration == track_item["duration"] assert track.media_number == track_item["media_number"] assert track.track_number == track_item["track_number"]
def track(): track_item = track_search_json["tracks"]["items"][0] return qobuz.Track(track_item)
def _update_tracks(self): resp = qobuz.api.request("album/get", album_id=self.id) self._tracks = [ qobuz.Track(t, album=self) for t in resp["tracks"]["items"] ]
def test_track_search_content(app, response_track_search): tracks = qobuz.Track.search(track_search_json["query"]) track_items = track_search_json["tracks"]["items"] assert tracks[0] == qobuz.Track(track_items[0]) assert tracks[1] == qobuz.Track(track_items[1])