Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Podcast RSS feed imports #413

merged 10 commits into from Apr 24, 2021
@@ -6,6 +6,7 @@ class RSS < Importer
def self.specify_options(c)
c.option "source", "--source NAME", "The RSS file or URL to import"
c.option "tag", "--tag NAME", "Add a tag to posts"
c.option "render_audio", "--render_audio", "Render <audio> element as necessary"

def self.validate(options)
@@ -32,6 +33,7 @@ def self.process(options)
source = options.fetch("source")
frontmatter = options.fetch("frontmatter", [])
body = options.fetch("body", ["description"])
render_audio = options.fetch("render_audio", false)

content = ""
open(source) { |s| content = }
@@ -43,6 +45,7 @@ def self.process(options)
formatted_date ="%Y-%m-%d")
post_name = Jekyll::Utils.slugify(item.title, :mode => "latin")
name = "#{formatted_date}-#{post_name}"
audio = render_audio && item.enclosure.url

header = {
"layout" => "post",
@@ -69,6 +72,16 @@ def self.process(options)"_posts/#{name}.html", "w") do |f|
f.puts header.to_yaml
f.puts "---\n\n"

if audio
f.puts <<~HTML
<audio controls="">
<source src="#{audio}" type="audio/mpeg">
Your browser does not support the audio element.

f.puts output