1
0
mirror of https://github.com/thebaer/cdr.git synced 2024-11-15 01:31:01 +00:00

Support additional track info in playlist

This allows the user-defined mixtape.tmpl to define track notes for each
individual track. By default, it only shows notes for the
currently-playing track.
This commit is contained in:
Matt Baer 2020-02-29 11:25:46 -05:00
parent 9a8150b144
commit 177f73cb49
3 changed files with 42 additions and 0 deletions

View File

@ -14,9 +14,16 @@
#playlist li {
margin: 0.5em 0;
}
li p {
display: none;
font-style: italic;
}
li.active a {
font-weight: bold;
}
li.active p {
display: block;
}
</style>
</head>
<body>
@ -24,3 +31,14 @@
</body>
</html>
{{end}}
{{define "track-info"}}
{{if eq .Num 1}}
<p>[Here I might introduce this mix.]</p>
<p>[Some notes about track 1.]</p>
{{else if eq .Num 2}}
<p>[Some notes about track 2.]</p>
{{else if eq .Num 5}}
<p>[Some notes about track 5.]</p>
{{end}}
{{end}}

View File

@ -34,15 +34,33 @@ var files = map[string]string{
#playlist li {
margin: 0.5em 0;
}
li p {
display: none;
font-style: italic;
}
li.active a {
font-weight: bold;
}
li.active p {
display: block;
}
</style>
</head>
<body>
{{template "full-player" .Tracks}}
</body>
</html>
{{end}}
{{define "track-info"}}
{{if eq .Num 1}}
<p>[Here I might introduce this mix.]</p>
<p>[Some notes about track 1.]</p>
{{else if eq .Num 2}}
<p>[Some notes about track 2.]</p>
{{else if eq .Num 5}}
<p>[Some notes about track 5.]</p>
{{end}}
{{end}}`,
"templates/parts.tmpl": `{{define "player"}}
{{with $x := index . 0}}
@ -56,11 +74,14 @@ var files = map[string]string{
{{range $i, $el := .}}
<li{{if eq $i 0}} class="active"{{end}}>
<a href="{{$el.Filename}}">{{$el.Artist}} - {{$el.Title}}</a>
{{template "track-info" $el}}
</li>
{{end}}
</ol>
{{end}}
{{define "track-info"}}{{end}}
{{define "full-player"}}
{{template "player" .}}
{{template "playlist" .}}

View File

@ -10,11 +10,14 @@
{{range $i, $el := .}}
<li{{if eq $i 0}} class="active"{{end}}>
<a href="{{$el.Filename}}">{{$el.Artist}} - {{$el.Title}}</a>
{{template "track-info" $el}}
</li>
{{end}}
</ol>
{{end}}
{{define "track-info"}}{{end}}
{{define "full-player"}}
{{template "player" .}}
{{template "playlist" .}}