Created
May 15, 2017 18:39
-
-
Save mikejakobsen/5fbfee5f04b9afef1570092464ed4696 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| title = "#{@user.username} podcast feed" | |
| author = @user.username | |
| description = "#{@user.username} feed" | |
| keywords = "comma, separated" | |
| image = ENV["ROOT_URL"] + '/logo.png' | |
| xml.rss "xmlns:itunes" => "http://www.itunes.com/dtds/podcast-1.0.dtd", "xmlns:media" => "http://search.yahoo.com/mrss/", :version => "2.0", "xmlns:atom" => "http://www.w3.org/2005/Atom" do | |
| xml.channel do | |
| xml.title title | |
| xml.link 'http://mikejakobsen.herokuapp.com' | |
| xml.description description | |
| xml.language 'da-DK' | |
| xml.atom :link, href: request.original_url, rel: 'self' | |
| if collection.any? | |
| xml.pubDate collection.first.created_at.to_s(:rfc822) | |
| xml.lastBuildDate collection.first.created_at.to_s(:rfc822) | |
| end | |
| xml.itunes :author, author | |
| xml.itunes :keywords, keywords | |
| xml.itunes :image, :href => image | |
| xml.itunes :owner do | |
| xml.itunes :name, author | |
| xml.itunes :email, current_user.email | |
| end | |
| xml.itunes :block, 'no' | |
| xml.itunes :category, :text => 'Technology' | |
| xml.itunes :explicit, 'no' | |
| collection.each do |episode| | |
| link = episode.original_url.presence || user_episode_url(episode) | |
| xml.item do | |
| xml.title episode.title | |
| xml.description episode.description | |
| xml.pubDate episode.created_at.to_s(:rfc822) | |
| xml.enclosure :url => download_user_episode_url(episode, format: 'mp3', token: params[:token]), | |
| :length => 0, :type => 'audio/mpeg' | |
| xml.link link | |
| xml.guid({:isPermaLink => "true"}, link) | |
| xml.itunes :author, author | |
| xml.itunes :subtitle, truncate(episode.description, :length => 150) | |
| xml.itunes :summary, episode.description[0..3999] | |
| xml.itunes :image, href: image | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment