-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
144 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package soundcloud | ||
|
||
import "fmt" | ||
|
||
func (p *Playlist) IsMain() bool { | ||
switch p.PlaylistType { | ||
case "single", "album", "compilation", "ep": | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
func (p *Playlist) Section() string { | ||
switch p.PlaylistType { | ||
case "album": | ||
return "albums" | ||
case "single", "ep": | ||
return "singles-eps" | ||
case "compilation": | ||
return "appears-on" | ||
} | ||
return "other" | ||
} | ||
|
||
func (p *Playlists) BySection(section string) []*Playlist { | ||
out := []*Playlist{} | ||
for _, playlist := range p.Playlists { | ||
if playlist.Section() == section { | ||
out = append(out, playlist) | ||
} | ||
} | ||
return out | ||
} | ||
|
||
func (p *Playlist) URL() string { | ||
return fmt.Sprintf("/album/%d", p.ID) | ||
} | ||
|
||
func (p *Playlist) IsExternal() bool { return true } | ||
|
||
func (p *Playlist) ImageURL() string { return p.ArtworkUrl } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,99 @@ | ||
{{define "title"}}Muzik{{end}} | ||
|
||
{{/* | ||
{% block title %}Des albums{% endblock %} | ||
{% block subtitle %}pas au hasard{% endblock %} | ||
*/}} | ||
|
||
{{define "content"}} | ||
Muzikkk | ||
{{ $columns := 2 }} | ||
{{ $grid_size := div 12 $columns }} | ||
{{ $square_size := 250 }} | ||
|
||
|
||
<div class="row"> | ||
<!--<pre>{{.playlists|toPrettyJson}}</pre>--> | ||
<h2>Albums</h2> | ||
{{ range $entry := (.playlists.BySection "albums") }} | ||
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 rotate-random2"> | ||
<!--<pre>{{$entry|toPrettyJson}}</pre>--> | ||
<a href="{{ $entry.URL}}" class="thumbnail" | ||
width="{{$square_size}}" height="{{$square_size}}" | ||
{{ if $entry.IsExternal }} target="_blank"{{ end }}> | ||
<div class="caption-wrapper"> | ||
<p class="caption"> | ||
{{ $entry.Title }} | ||
</p> | ||
</div> | ||
<img src="{{ $entry.ImageURL | resize "fill=500x500" }}" | ||
class="img-responsive" | ||
width="500" height="500" /> | ||
</a> | ||
</div> | ||
{{ end }} | ||
</div> | ||
|
||
<div class="row"> | ||
<h2>Singles & EPs</h2> | ||
{{ range $entry := (.playlists.BySection "singles-eps") }} | ||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 rotate-random2"> | ||
<!--<pre>{{$entry|toPrettyJson}}</pre>--> | ||
<a href="{{ $entry.URL}}" class="thumbnail" | ||
width="{{$square_size}}" height="{{$square_size}}" | ||
{{ if $entry.IsExternal }} target="_blank"{{ end }}> | ||
<div class="caption-wrapper"> | ||
<p class="caption"> | ||
{{ $entry.Title }} | ||
</p> | ||
</div> | ||
<img src="{{ $entry.ImageURL | resize "fill=250x250" }}" | ||
class="img-responsive" | ||
width="250" height="250" /> | ||
</a> | ||
</div> | ||
{{ end }} | ||
</div> | ||
|
||
<div class="row"> | ||
<h2>Compilations</h2> | ||
{{ range $entry := (.playlists.BySection "appears-on") }} | ||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 rotate-random2"> | ||
<!--<pre>{{$entry|toPrettyJson}}</pre>--> | ||
<a href="{{ $entry.URL}}" class="thumbnail" | ||
width="{{$square_size}}" height="{{$square_size}}" | ||
{{ if $entry.IsExternal }} target="_blank"{{ end }}> | ||
<div class="caption-wrapper"> | ||
<p class="caption"> | ||
{{ $entry.Title }} | ||
</p> | ||
</div> | ||
<img src="{{ $entry.ImageURL | resize "fill=250x250" }}" | ||
class="img-responsive" | ||
width="250" height="250" /> | ||
</a> | ||
</div> | ||
{{ end }} | ||
</div> | ||
|
||
<div class="row"> | ||
<h2>Brouillons</h2> | ||
{{ range $entry := (.playlists.BySection "other") }} | ||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 rotate-random2"> | ||
<!--<pre>{{$entry|toPrettyJson}}</pre>--> | ||
<a href="{{ $entry.URL}}" class="thumbnail" | ||
width="{{$square_size}}" height="{{$square_size}}" | ||
{{ if $entry.IsExternal }} target="_blank"{{ end }}> | ||
<div class="caption-wrapper"> | ||
<p class="caption"> | ||
{{ $entry.Title }} | ||
</p> | ||
</div> | ||
<img src="{{ $entry.ImageURL | resize "fill=250x250" }}" | ||
class="img-responsive" | ||
width="250" height="250" /> | ||
</a> | ||
</div> | ||
{{ end }} | ||
</div> | ||
|
||
{{end}} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters