Skip to content

Instantly share code, notes, and snippets.

@MartinWeiss12
Last active December 11, 2023 22:01
Show Gist options
  • Save MartinWeiss12/cdf5d615fdae906cf1709ff05629dc9e to your computer and use it in GitHub Desktop.
Save MartinWeiss12/cdf5d615fdae906cf1709ff05629dc9e to your computer and use it in GitHub Desktop.
Most Consecutive Streams
mpi = 0
max_count = 0
unique_uri_list = []
for i in range(len(uri_list) - 1):
if uri_list[i] == uri_list[i+1]:
count = count + 1
if count > max_count:
max_count = count
mpi = i
unique_uri_list.append(uri_list[i])
else:
count = 0
start_ts = ts_list[mpi - max_count]
track = track_list[mpi]
times_played = max_count
end_ts = ts_list[mpi]
print(f'You played {track} {times_played} times in a row from {start_ts} to {end_ts}.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment