Skip to content

Commit

Permalink
Merge pull request #70 from troykelly/68-dont-exhaust-genre-when-only…
Browse files Browse the repository at this point in the history
…-no-similar-tracks

Update main.py
  • Loading branch information
troykelly authored Jun 3, 2024
2 parents 75fbafa + d6c5075 commit 371b924
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/radioplaylist/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,6 @@ def refresh_genres(genres: List[str]) -> List[str]:
'',
)
for candidate in candidate_tracks:
if random.random() < 0.3:
break

similar_track = self.playlist_manager.get_track_by_title_and_artist(
candidate['title'], candidate['artist']
)
Expand All @@ -427,6 +424,9 @@ def refresh_genres(genres: List[str]) -> List[str]:
'',
)
add_track_to_playlist(similar_track, playlist)

if random.random() < 0.3:
break

return playlist

Expand Down

0 comments on commit 371b924

Please sign in to comment.