Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jcraigk committed Nov 3, 2024
1 parent 8b64b15 commit 08743a8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 22 deletions.
29 changes: 12 additions & 17 deletions app/services/show_importer/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class ShowImporter::Cli
attr_reader :orch

def initialize(date)
puts "Preparing #{date}"
puts "🗓️ Preparing #{date}"

@orch = ShowImporter::Orchestrator.new(date)
ShowImporter::TrackReplacer.new(date) && return if orch.show_found
Expand All @@ -15,7 +15,7 @@ def initialize(date)
def main_menu
print_header
orch.pp_list
puts "\n\nTrack #, (f)ilenames, (l)ist, (i)nsert, (d)elete, (s)ave, e(x)it: "
puts "\n\nTrack #, (f)ilenames, (l)ist, (i)nsert, (d)elete, (s)ave, e(x)it"
end

def print_header
Expand All @@ -26,14 +26,14 @@ def print_header

def print_show_title
puts \
"🏟 #{orch.show.date} - #{orch.show.venue.name_on(orch.show.date)} " \
"📍 #{orch.show.date} - #{orch.show.venue.name_on(orch.show.date)} " \
"- #{orch.show.venue.location}\n"
end

def print_notes
notes = orch.show.taper_notes&.encode! \
"UTF-8", "binary", invalid: :replace, undef: :replace, replace: ""
puts "📒 Taper Notes: #{pluralize(notes.split("\n").size, 'line')}" if notes.present?
puts "📝 Taper Notes: #{pluralize(notes.split("\n").size, 'line')}" if notes.present?
puts "\n"
end

Expand Down Expand Up @@ -62,7 +62,7 @@ def help_str

# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
def process_pos(pos)
while (line = Readline.readline(" ", false))
while (line = Readline.readline("👉 ", false))
case line.downcase
when "u"
puts(
Expand Down Expand Up @@ -93,20 +93,18 @@ def process_pos(pos)
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength

def insert_new_track
puts "Before track #:"
line = Readline.readline(" ", true)
puts
line = Readline.readline("Before track # 👉 ", true)
orch.insert_before(line.to_i)
end

def delete_track
puts "Delete track #:"
line = Readline.readline("➡ ", true)
line = Readline.readline("Delete track # 👉 ", true)
orch.delete(line.to_i)
end

def update_song_for_pos(pos)
puts "Enter exact song title:"
line = Readline.readline("➡ ", true)
line = Readline.readline("Song title 👉 ", true)
matched = orch.fm.find_song(line, exact: true)
if matched
puts "Found \"#{matched.title}\". Adding Song."
Expand All @@ -117,23 +115,20 @@ def update_song_for_pos(pos)
end

def update_title_for_pos(pos)
puts "Enter new title:"
line = Readline.readline("➡ ", true)
line = Readline.readline("Title 👉 ", true)
orch.get_track(pos).title = line
puts
end

def update_set_for_pos(pos)
puts "Enter new set abbrev [S,1,2,3,4,E,E2,E3]:"
line = Readline.readline("➡ ", true)
line = Readline.readline("Set [S,1,2,3,4,E,E2,E3] 👉 ", true)
orch.get_track(pos).set = line
puts
end

def update_file_for_pos(pos) # rubocop:disable Metrics/MethodLength
puts "Choose a file:"
filenames = print_filenames
while (line = Readline.readline("1-#{filenames.length} "))
while (line = Readline.readline("File 1-#{filenames.length} 👉 "))
choice = line.to_i
next unless choice.positive?
new_filename = filenames[choice - 1]
Expand Down
6 changes: 2 additions & 4 deletions config/initializers/sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@
config.redis = redis_config
end

# Disable connection message on rspec runs and rake tasks in prod
if Rails.env.test? || Rails.env.production?
Sidekiq.logger.level = Logger::WARN
end
# Disable annoying connection messages
Sidekiq.logger.level = Logger::WARN
2 changes: 1 addition & 1 deletion lib/tasks/shows.rake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace :shows do
dates = Dir.entries(App.content_import_path).grep(/\d{4}\-\d{1,2}\-\d{1,2}\z/).sort
next puts "❌ No shows found in #{App.content_import_path}" unless dates.any?

puts "🔎 #{pluralize(dates.size, 'folder')} found"
puts "📂 #{pluralize(dates.size, 'folder')} found"
dates.each { |date| ShowImporter::Cli.new(date) }
end
end

0 comments on commit 08743a8

Please sign in to comment.