m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/recording.rb20
-rw-r--r--lib/song.rb9
2 files changed, 21 insertions, 8 deletions
diff --git a/lib/recording.rb b/lib/recording.rb
index d1d7683..68b0428 100644
--- a/lib/recording.rb
+++ b/lib/recording.rb
@@ -24,13 +24,23 @@ class YouTubeRecording
end
class BandcampRecording
- attr_accessor :link
- def initialize link
- @link = link
+ attr_accessor :embed
+ def initialize _embed
+ @embed = _embed
end
def render
- template = ERB.new(File.read('templates/bandcamp.html.erb'), trim_mode: '-')
- template.result binding
+ @embed
+ end
+end
+
+class SoundCloudRecording
+ attr_accessor :embed
+ def initialize _embed
+ @embed = _embed
+ end
+
+ def render
+ @embed
end
end
diff --git a/lib/song.rb b/lib/song.rb
index 4076956..151fa6c 100644
--- a/lib/song.rb
+++ b/lib/song.rb
@@ -22,10 +22,13 @@ class Song
if metadata['recordings']
metadata['recordings'].each do |recording|
- if recording['type'] == 'youtube'
+ case recording['type']
+ when 'youtube'
song.recordings.push YouTubeRecording.new(recording['link'])
- elsif recording['type'] == 'bandcamp'
- song.recordings.push BandcampRecording.new(recording['link'])
+ when 'bandcamp'
+ song.recordings.push BandcampRecording.new(recording['embed'])
+ when 'soundcloud'
+ song.recordings.push SoundCloudRecording.new(recording['embed'])
end
end
end