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

script to assign unassigned podcasts from CSV #338

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions script/add_podcast_to_show_series.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'csv'

csv_path = "/tmp/missing_podcasts.csv"

CSV.foreach(csv_path, headers: true) do |row|
# show_title = row[:show_series]
slug = row[:show_series_slug]
show_series = ShowSeries.friendly.find slug
track = Track.find_by(title: row[:title])
if show_series
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should check for track too. there's quite a few records in that csv that have no title

episode = show_series.scheduled_shows.new title: row[:title], start_at: row[:created_at], end_at: row[:created_at], status: "archive_published"
episode.save!
track.update scheduled_show: episode
end
end