diff --git a/lib/pod/commands/add/runner.rb b/lib/pod/commands/add/runner.rb index 2925ef9..df16bca 100644 --- a/lib/pod/commands/add/runner.rb +++ b/lib/pod/commands/add/runner.rb @@ -21,29 +21,29 @@ def call(feed, options = {}) return build_failure_response(details: :missing_sync_url) if podcast_feed.nil? db.execute <<-SQL - insert into podcasts - (name, description, feed, website) - values ( - "#{escape_double_quotes(podcast.name)}", - "#{escape_double_quotes(podcast.description)}", - "#{escape_double_quotes(podcast_feed)}", - "#{escape_double_quotes(podcast.website)}" - ); + insert into podcasts + (name, description, feed, website) + values ( + "#{escape_double_quotes(podcast.name)}", + "#{escape_double_quotes(podcast.description)}", + "#{escape_double_quotes(podcast_feed)}", + "#{escape_double_quotes(podcast.website)}" + ); SQL inserted_podcast_id = db.query("select id from podcasts order by id desc limit 1;").first.id parsed_feed.episodes.each do |e| db.execute <<-SQL - insert into episodes - (title, release_date, podcast_id, duration, link, external_id) - values ( - "#{escape_double_quotes(e.title)}", - "#{escape_double_quotes(e.release_date)}", - #{inserted_podcast_id}, - "#{escape_double_quotes(e.duration)}", - "#{escape_double_quotes(e.link)}", - "#{e.external_id}" - ); + insert into episodes + (title, release_date, podcast_id, duration, link, external_id) + values ( + "#{escape_double_quotes(e.title)}", + "#{escape_double_quotes(e.release_date)}", + #{inserted_podcast_id}, + "#{escape_double_quotes(e.duration)}", + "#{escape_double_quotes(e.link)}", + "#{e.external_id}" + ); SQL end end diff --git a/lib/pod/commands/sync/runner.rb b/lib/pod/commands/sync/runner.rb index f934585..cba7e03 100644 --- a/lib/pod/commands/sync/runner.rb +++ b/lib/pod/commands/sync/runner.rb @@ -14,16 +14,16 @@ def call(podcast_id) parsed_feed = Infrastructure::FeedParser.call(podcast.feed) parsed_feed.episodes.each do |e| db.execute <<-SQL - insert or ignore into episodes - (title, release_date, podcast_id, duration, link, external_id) - values ( - "#{escape_double_quotes(e.title)}", - "#{escape_double_quotes(e.release_date)}", - #{podcast_id}, - "#{escape_double_quotes(e.duration)}", - "#{escape_double_quotes(e.link)}", - "#{e.external_id}" - ); + insert or ignore into episodes + (title, release_date, podcast_id, duration, link, external_id) + values ( + "#{escape_double_quotes(e.title)}", + "#{escape_double_quotes(e.release_date)}", + #{podcast_id}, + "#{escape_double_quotes(e.duration)}", + "#{escape_double_quotes(e.link)}", + "#{e.external_id}" + ); SQL end build_success_response(details: :podcast_synchronized)