Skip to content

Commit 35d7672

Browse files
committed
comment out setting track artwork for now
1 parent af91916 commit 35d7672

2 files changed

Lines changed: 20 additions & 18 deletions

File tree

app/models/track.rb

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Track < ActiveRecord::Base
3232
if: -> { scheduled_show_id.present? }
3333

3434

35-
before_post_process :transliterate_file_name
35+
# before_post_process :transliterate_file_name
3636

3737
has_tags column: :s3_filepath, storage: :s3,
3838
artwork_column: :artwork,
@@ -121,22 +121,23 @@ def set_tags_from_scheduled_show
121121
if self.title.blank?
122122
self.title = "#{self.scheduled_show.title} - #{self.scheduled_show.start_at.strftime("%m%d%Y")}"
123123
end
124-
unless self.artwork.present?
125-
if self.scheduled_show.image.present?
126-
self.artwork = self.scheduled_show.image
127-
elsif self.scheduled_show.dj.image.present?
128-
self.artwork = self.scheduled_show.dj.image
129-
end
130-
end
124+
# TODO convert so_id3 to use active_storage
125+
# unless self.artwork.present?
126+
# if self.scheduled_show.representative_image.present?
127+
# self.artwork = self.scheduled_show.representative_image
128+
# elsif self.scheduled_show.dj.image.present?
129+
# self.artwork = self.scheduled_show.dj.image
130+
# end
131+
# end
131132
end
132133
end
133134

134-
def transliterate_file_name
135-
base = "#{self.artist}_#{self.title}_#{self.album}"
136-
mime = self.artwork.content_type
137-
ext = Rack::Mime::MIME_TYPES.invert[mime]
138-
139-
new_file_name = "#{base.parameterize}_#{Digest::SHA256.hexdigest(base)}#{ext}"
140-
self.artwork.instance_write(:file_name, new_file_name)
141-
end
135+
# def transliterate_file_name
136+
# base = "#{self.artist}_#{self.title}_#{self.album}"
137+
# mime = self.artwork.content_type
138+
# ext = Rack::Mime::MIME_TYPES.invert[mime]
139+
#
140+
# new_file_name = "#{base.parameterize}_#{Digest::SHA256.hexdigest(base)}#{ext}"
141+
# self.artwork.instance_write(:file_name, new_file_name)
142+
# end
142143
end

spec/models/track_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@
3737

3838
describe "scheduled show" do
3939
# FIXME doesn't pass on CI
40-
xit "pulls tags and artwork from scheduled show if not set" do
40+
it "pulls tags and artwork from scheduled show if not set" do
4141
VCR.use_cassette(RSpec.current_example.metadata[:full_description].to_s, match_requests_on: [:s3_image_matcher, :method, :host]) do
4242
start_at = Chronic.parse("today at 1:15 pm").utc
4343
end_at = Chronic.parse("today at 3:15 pm").utc
4444
radio = Radio.create name: 'datafruits'
4545
track = Track.new audio_file_name: 'http://s3.amazonaws.com/streampusher/doo.mp3'
46-
scheduled_show = ScheduledShow.create radio: radio, start_at: start_at, end_at: end_at, title: "hey hey", image: File.new("spec/fixtures/images/pineapple.png")
46+
scheduled_show = ScheduledShow.create radio: radio, start_at: start_at, end_at: end_at, title: "hey hey"# , image: File.new("spec/fixtures/images/pineapple.png")
47+
scheduled_show.as_image.attach(io: File.open("spec/fixtures/images/pineapple.png"), filename: "pineapple.png")
4748
track.scheduled_show = scheduled_show
4849
track.save
4950
formatted_time = scheduled_show.start_at.strftime("%m%d%Y")

0 commit comments

Comments
 (0)