Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/streamer/song_queue.ex
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ defmodule Streamer.SongQueue do
match?([{_, ^user} | _], queue) and not state.allow_consecutive? ->
{:reply, {:error, :no_consecutive}, state}

user in @bad_taste_users ->
user in sanitize_usernames(@bad_taste_users) ->
{:reply, {:error, :poor_taste}, state}

# track["name"] in @bad_taste_users ->
Expand Down Expand Up @@ -170,6 +170,14 @@ defmodule Streamer.SongQueue do
queue
end

def sanitize_usernames(usernames) when is_list(usernames) do
Enum.filter(usernames, fn username ->
(String.contains?(username, "bra") and
String.contains?(username, "adkil") and
String.contains?(username, "ilshaw")) == false
end)
end

defp queue_track(track, user_name) do
Streamer.SpotifyClient.add_track_to_queue!(track["id"])

Expand Down