From bf2281d1c948da3d578f8160a077b5381c1a2671 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Fri, 10 Dec 2021 14:48:47 +0100 Subject: Fix Bandcamp, add Soundcloud embeds --- lib/recording.rb | 20 +++++++++++++++----- lib/song.rb | 9 ++++++--- src/songs/jeszcze-nie-do-dom.yaml | 3 ++- src/songs/sowa-na-gaju-siada.yaml | 3 ++- "src/songs/s\304\231dkowian.yaml" | 4 ++++ src/songs/w-stodole-sowa-siada.yaml | 3 ++- "src/songs/z\305\202ote-serce.yaml" | 3 ++- "src/songs/\305\233piwa-kowalikowej.yaml" | 4 ++-- 8 files changed, 35 insertions(+), 14 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 diff --git a/src/songs/jeszcze-nie-do-dom.yaml b/src/songs/jeszcze-nie-do-dom.yaml index e2bf298..63035e5 100644 --- a/src/songs/jeszcze-nie-do-dom.yaml +++ b/src/songs/jeszcze-nie-do-dom.yaml @@ -1,4 +1,5 @@ title: Jeszcze nie do dom recordings: - type: soundcloud - link: https://soundcloud.com/darek-a/jakielaszek-jeszcze-nie-do-dom + embed: > +
dada · Jakielaszek-jeszcze nie do dom
diff --git a/src/songs/sowa-na-gaju-siada.yaml b/src/songs/sowa-na-gaju-siada.yaml index 323083f..90f2150 100644 --- a/src/songs/sowa-na-gaju-siada.yaml +++ b/src/songs/sowa-na-gaju-siada.yaml @@ -1,4 +1,5 @@ title: Sowa na gaju siada recordings: - type: soundcloud - link: https://soundcloud.com/tadirindum/sowa-na-gaju-siada + embed: > +
Tadirindum · Sowa na gaju siada
diff --git "a/src/songs/s\304\231dkowian.yaml" "b/src/songs/s\304\231dkowian.yaml" index 5a03735..a18a845 100644 --- "a/src/songs/s\304\231dkowian.yaml" +++ "b/src/songs/s\304\231dkowian.yaml" @@ -1 +1,5 @@ title: Sędkowian +recordings: + - type: bandcamp + embed: > + diff --git a/src/songs/w-stodole-sowa-siada.yaml b/src/songs/w-stodole-sowa-siada.yaml index ff54cd3..87a237f 100644 --- a/src/songs/w-stodole-sowa-siada.yaml +++ b/src/songs/w-stodole-sowa-siada.yaml @@ -1,4 +1,5 @@ title: W stodole sowa siada recordings: - type: soundcloud - link: https://soundcloud.com/kapela-niwi-skich/sowy + embed: > +
Kapela Niwińskich · Sowy
diff --git "a/src/songs/z\305\202ote-serce.yaml" "b/src/songs/z\305\202ote-serce.yaml" index 3f041b0..bbbb066 100644 --- "a/src/songs/z\305\202ote-serce.yaml" +++ "b/src/songs/z\305\202ote-serce.yaml" @@ -6,4 +6,5 @@ recordings: - type: youtube link: https://www.youtube.com/watch?v=ev5ByPvzgQs - type: bandcamp - link: https://bandcamp.com/EmbeddedPlayer/album=638636524/size=large/bgcol=ffffff/linkcol=0687f5/tracklist=false/artwork=small/track=3169851179/transparent=true/ + embed: > + diff --git "a/src/songs/\305\233piwa-kowalikowej.yaml" "b/src/songs/\305\233piwa-kowalikowej.yaml" index 8197f59..3c321fa 100644 --- "a/src/songs/\305\233piwa-kowalikowej.yaml" +++ "b/src/songs/\305\233piwa-kowalikowej.yaml" @@ -1,5 +1,5 @@ title: Śpiwa Kowalikowej recordings: - type: bandcamp - link: https://tegiechlopy.bandcamp.com/track/piwa-kowalikowej - link: https://bandcamp.com/EmbeddedPlayer/album=2743568323/size=large/bgcol=ffffff/linkcol=0687f5/tracklist=false/artwork=small/track=2249739060/transparent=true/ + embed: > + -- cgit v1.2.3