|
|
|
|
@@ -85,6 +85,7 @@ def artist_match(tidal_track: tidalapi.Track, spotify_track) -> bool:
|
|
|
|
|
return get_tidal_artists(tidal_track, True).intersection(get_spotify_artists(spotify_track, True)) != set()
|
|
|
|
|
|
|
|
|
|
def match(tidal_track, spotify_track) -> bool:
|
|
|
|
|
if not spotify_track['id']: return False
|
|
|
|
|
return isrc_match(tidal_track, spotify_track) or (
|
|
|
|
|
duration_match(tidal_track, spotify_track)
|
|
|
|
|
and name_match(tidal_track, spotify_track)
|
|
|
|
|
@@ -154,7 +155,7 @@ async def repeat_on_request_error(function, *args, remaining=5, **kwargs):
|
|
|
|
|
time.sleep(sleep_schedule.get(remaining, 1))
|
|
|
|
|
return await repeat_on_request_error(function, *args, remaining=remaining-1, **kwargs)
|
|
|
|
|
|
|
|
|
|
async def get_tracks_from_spotify_playlist(spotify_session: spotipy.Spotify, spotify_playlist: t_spotify.SpotifyPlaylist):
|
|
|
|
|
async def get_tracks_from_spotify_playlist(spotify_session: spotipy.Spotify, spotify_playlist):
|
|
|
|
|
def _get_tracks_from_spotify_playlist(offset: int, spotify_session: spotipy.Spotify, playlist_id: str):
|
|
|
|
|
fields="next,total,limit,items(track(name,album(name,artists),artists,track_number,duration_ms,id,external_ids(isrc)))"
|
|
|
|
|
return spotify_session.playlist_tracks(playlist_id, fields, offset=offset)
|
|
|
|
|
@@ -214,6 +215,7 @@ def get_tracks_for_new_tidal_playlist(spotify_tracks: Sequence[t_spotify.Spotify
|
|
|
|
|
output = []
|
|
|
|
|
seen_tracks = set()
|
|
|
|
|
for spotify_track in spotify_tracks:
|
|
|
|
|
if not spotify_track['id']: continue
|
|
|
|
|
tidal_id = track_match_cache.get(spotify_track['id'])
|
|
|
|
|
if tidal_id and not tidal_id in seen_tracks:
|
|
|
|
|
output.append(tidal_id)
|
|
|
|
|
|