-
-
Notifications
You must be signed in to change notification settings - Fork 73
/
mixcloud_feed.erb
30 lines (27 loc) · 1.2 KB
/
mixcloud_feed.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>mixcloud:<%= @username %></id>
<title><%= @user %> on Mixcloud</title>
<icon>https://www.mixcloud.com/favicon.ico</icon>
<link href="<%= request.original_url.esc %>" rel="self" />
<link href="https://www.mixcloud.com/<%= @username %>/" rel="alternate" />
<updated><%= Time.parse(@data[0]["created_time"]) if @data[0] %></updated>
<%- @data.each do |track| -%>
<entry>
<id>mixcloud:track:<%= track["slug"] %><%= ":#{params[:cachebuster]}" if params[:cachebuster] %></id>
<title>[<%= track["audio_length"].to_duration %>] <%= track["name"].to_line.esc %></title>
<link href="<%= track["url"].esc %>" />
<updated><%= Time.parse(track["created_time"]) %></updated>
<author><name><%= track["user"]["username"] %></name></author>
<content type="html">
<%=
<<-EOF.undent.esc
<iframe width="100%" height="120" src="https://www.mixcloud.com/widget/iframe/?feed=#{track["url"]}&hide_cover=1&light=1" frameborder="0"></iframe>
<a href="#{track["pictures"]["extra_large"]}"><img src="#{track["pictures"]["medium"]}"></a>
#{track["name"].to_paragraphs}
EOF
-%>
</content>
</entry>
<%- end -%>
</feed>