diff options
| author | Marcin Chrzanowski <m@m-chrzan.xyz> | 2021-12-10 14:48:47 +0100 | 
|---|---|---|
| committer | Marcin Chrzanowski <m@m-chrzan.xyz> | 2021-12-10 14:48:47 +0100 | 
| commit | bf2281d1c948da3d578f8160a077b5381c1a2671 (patch) | |
| tree | 089db043c23046f1aa2af2300ded06f2f63cdf9f | |
| parent | bae7995053a3fe0d293e5bd3f9c2770e27e95d8e (diff) | |
Fix Bandcamp, add Soundcloud embeds
| -rw-r--r-- | lib/recording.rb | 20 | ||||
| -rw-r--r-- | lib/song.rb | 9 | ||||
| -rw-r--r-- | src/songs/jeszcze-nie-do-dom.yaml | 3 | ||||
| -rw-r--r-- | src/songs/sowa-na-gaju-siada.yaml | 3 | ||||
| -rw-r--r-- | src/songs/sędkowian.yaml | 4 | ||||
| -rw-r--r-- | src/songs/w-stodole-sowa-siada.yaml | 3 | ||||
| -rw-r--r-- | src/songs/złote-serce.yaml | 3 | ||||
| -rw-r--r-- | src/songs/śpiwa-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: > +      <iframe width="100%" height="300" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/75618732&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe><div style="font-size: 10px; color: #cccccc;line-break: anywhere;word-break: normal;overflow: hidden;white-space: nowrap;text-overflow: ellipsis; font-family: Interstate,Lucida Grande,Lucida Sans Unicode,Lucida Sans,Garuda,Verdana,Tahoma,sans-serif;font-weight: 100;"><a href="https://soundcloud.com/darek-a" title="dada" target="_blank" style="color: #cccccc; text-decoration: none;">dada</a> · <a href="https://soundcloud.com/darek-a/jakielaszek-jeszcze-nie-do-dom" title="Jakielaszek-jeszcze nie do dom" target="_blank" style="color: #cccccc; text-decoration: none;">Jakielaszek-jeszcze nie do dom</a></div> 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: > +      <iframe width="100%" height="166" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/236816853&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true"></iframe><div style="font-size: 10px; color: #cccccc;line-break: anywhere;word-break: normal;overflow: hidden;white-space: nowrap;text-overflow: ellipsis; font-family: Interstate,Lucida Grande,Lucida Sans Unicode,Lucida Sans,Garuda,Verdana,Tahoma,sans-serif;font-weight: 100;"><a href="https://soundcloud.com/tadirindum" title="Tadirindum" target="_blank" style="color: #cccccc; text-decoration: none;">Tadirindum</a> · <a href="https://soundcloud.com/tadirindum/sowa-na-gaju-siada" title="Sowa na gaju siada" target="_blank" style="color: #cccccc; text-decoration: none;">Sowa na gaju siada</a></div> diff --git a/src/songs/sędkowian.yaml b/src/songs/sędkowian.yaml index 5a03735..a18a845 100644 --- a/src/songs/sędkowian.yaml +++ b/src/songs/sędkowian.yaml @@ -1 +1,5 @@  title: Sędkowian +recordings: +  - type: bandcamp +    embed: > +      <iframe style="border: 0; width: 100%; height: 120px;" src="https://bandcamp.com/EmbeddedPlayer/album=638636524/size=large/bgcol=ffffff/linkcol=0687f5/tracklist=false/artwork=small/track=45182251/transparent=true/" seamless><a href="https://tegiechlopy.bandcamp.com/album/wesele">Wesele! by Tęgie Chłopy</a></iframe> 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: > +      <iframe width="100%" height="166" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/608986038&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true"></iframe><div style="font-size: 10px; color: #cccccc;line-break: anywhere;word-break: normal;overflow: hidden;white-space: nowrap;text-overflow: ellipsis; font-family: Interstate,Lucida Grande,Lucida Sans Unicode,Lucida Sans,Garuda,Verdana,Tahoma,sans-serif;font-weight: 100;"><a href="https://soundcloud.com/kapela-niwi-skich" title="Kapela Niwińskich" target="_blank" style="color: #cccccc; text-decoration: none;">Kapela Niwińskich</a> · <a href="https://soundcloud.com/kapela-niwi-skich/sowy" title="Sowy" target="_blank" style="color: #cccccc; text-decoration: none;">Sowy</a></div> diff --git a/src/songs/złote-serce.yaml b/src/songs/złote-serce.yaml index 3f041b0..bbbb066 100644 --- a/src/songs/złote-serce.yaml +++ b/src/songs/złote-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: > +      <iframe style="border: 0; width: 100%; height: 120px;" src="https://bandcamp.com/EmbeddedPlayer/album=638636524/size=large/bgcol=ffffff/linkcol=0687f5/tracklist=false/artwork=small/track=3169851179/transparent=true/" seamless><a href="https://tegiechlopy.bandcamp.com/album/wesele">Wesele! by Tęgie Chłopy</a></iframe> diff --git a/src/songs/śpiwa-kowalikowej.yaml b/src/songs/śpiwa-kowalikowej.yaml index 8197f59..3c321fa 100644 --- a/src/songs/śpiwa-kowalikowej.yaml +++ b/src/songs/śpiwa-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: > +      <iframe style="border: 0; width: 100%; height: 120px;" src="https://bandcamp.com/EmbeddedPlayer/album=2743568323/size=large/bgcol=ffffff/linkcol=0687f5/tracklist=false/artwork=small/track=2249739060/transparent=true/" seamless><a href="https://tegiechlopy.bandcamp.com/album/dansing">Dansing by Tęgie Chłopy</a></iframe>  |