Skip to content

Commit

Permalink
Ensure unique id in Twitch feed. Not sure if it matters anywhere though.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Nov 22, 2018
1 parent c78e2c0 commit 8e44688
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,7 @@

get %r{/twitch/directory/game/(?<id>\d+)/(?<game_name>.+)} do |id, game_name|
@id = id
@type = "game"

type = %w[all upload archive highlight].pick(params[:type]) || "all"
response = Twitch.get("/videos", query: { game_id: id, type: type })
Expand All @@ -1055,6 +1056,7 @@

get %r{/twitch/(?<id>\d+)/(?<user>.+)} do |id, user|
@id = id
@type = "user"

type = %w[all upload archive highlight].pick(params[:type]) || "all"
response = Twitch.get("/videos", query: { user_id: id, type: type })
Expand Down
2 changes: 1 addition & 1 deletion views/twitch_feed.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%- content_type :atom -%>
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>twitch:<%= @id %></id>
<id>twitch:<%= @type %>:<%= @id %></id>
<title><%= @title.esc %></title>
<icon>https://www.twitch.tv/favicon.ico</icon>
<link href="<%= request.original_url.esc %>" rel="self" />
Expand Down

0 comments on commit 8e44688

Please sign in to comment.