-
Notifications
You must be signed in to change notification settings - Fork 6
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
mcfiredrill
wants to merge
16
commits into
main
Choose a base branch
from
import-unassigned-podcasts-script
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
26401a9
script to assign unassigned podcasts from CSV
mcfiredrill 42bd216
WIP
mcfiredrill 5cf38b1
fix title
mcfiredrill 4f9da42
copy track labels to episode labels
mcfiredrill d6b2361
wip lost podcasts script
mcfiredrill 375ebf7
user mapping for import script
mcfiredrill c034cac
wip on script
mcfiredrill f7c0848
finish up script
mcfiredrill 7a88aa8
Merge remote-tracking branch 'origin/main' into import-unassigned-pod…
mcfiredrill 409f2a9
raise error
mcfiredrill 0b17f84
Merge remote-tracking branch 'origin/main' into import-unassigned-pod…
mcfiredrill f0835b6
make sure its a valid user
mcfiredrill 9e8f3c9
Merge remote-tracking branch 'origin/main' into import-unassigned-pod…
mcfiredrill 5d7f51a
fix user creation in add_podcast_to_show_series
mcfiredrill f3e9395
make sure scheduled show archive is published
mcfiredrill 4595166
use transaction
mcfiredrill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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 | ||
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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