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:
parent
9a8150b144
commit
177f73cb49
18
mixtape.tmpl
18
mixtape.tmpl
@ -14,13 +14,31 @@
|
|||||||
#playlist li {
|
#playlist li {
|
||||||
margin: 0.5em 0;
|
margin: 0.5em 0;
|
||||||
}
|
}
|
||||||
|
li p {
|
||||||
|
display: none;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
li.active a {
|
li.active a {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
li.active p {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{template "full-player" .Tracks}}
|
{{template "full-player" .Tracks}}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</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}}
|
{{end}}
|
21
templates.go
21
templates.go
@ -34,15 +34,33 @@ var files = map[string]string{
|
|||||||
#playlist li {
|
#playlist li {
|
||||||
margin: 0.5em 0;
|
margin: 0.5em 0;
|
||||||
}
|
}
|
||||||
|
li p {
|
||||||
|
display: none;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
li.active a {
|
li.active a {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
li.active p {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{template "full-player" .Tracks}}
|
{{template "full-player" .Tracks}}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</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}}`,
|
{{end}}`,
|
||||||
"templates/parts.tmpl": `{{define "player"}}
|
"templates/parts.tmpl": `{{define "player"}}
|
||||||
{{with $x := index . 0}}
|
{{with $x := index . 0}}
|
||||||
@ -56,11 +74,14 @@ var files = map[string]string{
|
|||||||
{{range $i, $el := .}}
|
{{range $i, $el := .}}
|
||||||
<li{{if eq $i 0}} class="active"{{end}}>
|
<li{{if eq $i 0}} class="active"{{end}}>
|
||||||
<a href="{{$el.Filename}}">{{$el.Artist}} - {{$el.Title}}</a>
|
<a href="{{$el.Filename}}">{{$el.Artist}} - {{$el.Title}}</a>
|
||||||
|
{{template "track-info" $el}}
|
||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
</ol>
|
</ol>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
{{define "track-info"}}{{end}}
|
||||||
|
|
||||||
{{define "full-player"}}
|
{{define "full-player"}}
|
||||||
{{template "player" .}}
|
{{template "player" .}}
|
||||||
{{template "playlist" .}}
|
{{template "playlist" .}}
|
||||||
|
@ -10,11 +10,14 @@
|
|||||||
{{range $i, $el := .}}
|
{{range $i, $el := .}}
|
||||||
<li{{if eq $i 0}} class="active"{{end}}>
|
<li{{if eq $i 0}} class="active"{{end}}>
|
||||||
<a href="{{$el.Filename}}">{{$el.Artist}} - {{$el.Title}}</a>
|
<a href="{{$el.Filename}}">{{$el.Artist}} - {{$el.Title}}</a>
|
||||||
|
{{template "track-info" $el}}
|
||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
</ol>
|
</ol>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
{{define "track-info"}}{{end}}
|
||||||
|
|
||||||
{{define "full-player"}}
|
{{define "full-player"}}
|
||||||
{{template "player" .}}
|
{{template "player" .}}
|
||||||
{{template "playlist" .}}
|
{{template "playlist" .}}
|
||||||
|
Loading…
Reference in New Issue
Block a user