library_detail.html
| 1 | {{define "library_detail"}} |
| 2 | <div class="detail-view"> |
| 3 | <div class="detail-header"> |
| 4 | <h2>{{.Data.Item.Name}}</h2> |
| 5 | <details class="delete-overlay"> |
| 6 | <summary role="button" class="small danger">Delete</summary> |
| 7 | <div class="overlay-panel"> |
| 8 | <p>Are you sure you want to delete this item?</p> |
| 9 | <form method="post" action="/library/item/{{urlEncodePath .Data.Item.RelPath}}/delete" class="form-actions"> |
| 10 | <button type="submit" class="danger">Yes, Delete</button> |
| 11 | </form> |
| 12 | </div> |
| 13 | </details> |
| 14 | </div> |
| 15 | |
| 16 | {{if gt (len .Data.Item.MediaFiles) 1}} |
| 17 | <form method="get" action="/library/item/{{urlEncodePath .Data.Item.RelPath}}" class="file-selector"> |
| 18 | <label for="file">Playing</label> |
| 19 | <select id="file" name="file" onchange="this.form.submit()"> |
| 20 | {{range .Data.Item.MediaFiles}} |
| 21 | <option value="{{.Filename}}" {{if eq .Filename $.Data.SelectedFilename}}selected{{end}}>{{.Filename}}</option> |
| 22 | {{end}} |
| 23 | </select> |
| 24 | </form> |
| 25 | {{end}} |
| 26 | |
| 27 | {{range .Data.Item.MediaFiles}} |
| 28 | {{if eq .Filename $.Data.SelectedFilename}} |
| 29 | <div class="player-container"> |
| 30 | {{if .IsAudio}} |
| 31 | <audio controls> |
| 32 | <source src="/media/item/{{urlEncodePath $.Data.Item.RelPath}}?file={{.Filename}}" type="{{mimeType .Filepath}}"> |
| 33 | Your browser does not support the audio element. |
| 34 | </audio> |
| 35 | {{else}} |
| 36 | <video controls preload="metadata"> |
| 37 | <source src="/media/item/{{urlEncodePath $.Data.Item.RelPath}}?file={{.Filename}}" type="{{mimeType .Filepath}}"> |
| 38 | {{range $.Data.Subtitles}} |
| 39 | <track kind="subtitles" src="{{.Src}}" srclang="{{.Lang}}" label="{{.Label}}"> |
| 40 | {{end}} |
| 41 | Your browser does not support the video element. |
| 42 | </video> |
| 43 | {{end}} |
| 44 | </div> |
| 45 | {{end}} |
| 46 | {{end}} |
| 47 | |
| 48 | <div class="detail-meta"> |
| 49 | <dl> |
| 50 | {{if .Data.Item.SourceURL}} |
| 51 | <dt>Source URL</dt> |
| 52 | <dd><a href="{{.Data.Item.SourceURL}}" target="_blank">{{.Data.Item.SourceURL}}</a></dd> |
| 53 | {{end}} |
| 54 | |
| 55 | {{if .Data.Item.Description}} |
| 56 | {{$longDesc := isLongText .Data.Item.Description}} |
| 57 | <dt>Description</dt> |
| 58 | <dd class="description{{if $longDesc}} collapsible{{end}}"> |
| 59 | {{if $longDesc}}<input type="checkbox" id="desc-toggle" class="desc-toggle">{{end}} |
| 60 | <div class="desc-text">{{.Data.Item.Description}}</div> |
| 61 | {{if $longDesc}}<label for="desc-toggle" class="desc-toggle-label"></label>{{end}} |
| 62 | </dd> |
| 63 | {{end}} |
| 64 | </dl> |
| 65 | |
| 66 | <details> |
| 67 | <summary role="button" class="small secondary">More Details</summary> |
| 68 | <dl> |
| 69 | {{if .Data.SelectedFilename}} |
| 70 | <dt>File</dt> |
| 71 | <dd>{{.Data.SelectedFilename}}</dd> |
| 72 | {{end}} |
| 73 | |
| 74 | {{if .Data.Metadata}} |
| 75 | {{if .Data.Metadata.Container}} |
| 76 | <dt>Container</dt> |
| 77 | <dd>{{.Data.Metadata.Container}}</dd> |
| 78 | {{end}} |
| 79 | |
| 80 | {{if .Data.Metadata.Resolution}} |
| 81 | <dt>Resolution</dt> |
| 82 | <dd>{{.Data.Metadata.Resolution}}</dd> |
| 83 | {{end}} |
| 84 | |
| 85 | {{range .Data.Metadata.VideoStreams}} |
| 86 | <dt>Video</dt> |
| 87 | <dd> |
| 88 | {{.Codec}} |
| 89 | {{if .Profile}}({{.Profile}}){{end}} |
| 90 | {{if .Width}}[{{.Width}}x{{.Height}}]{{end}} |
| 91 | {{if .FPS}}@ {{.FPS}} fps{{end}} |
| 92 | {{if .PixelFormat}}, {{.PixelFormat}}{{end}} |
| 93 | {{if .Bitrate}}, {{.Bitrate}} kbps{{end}} |
| 94 | </dd> |
| 95 | {{end}} |
| 96 | |
| 97 | {{range .Data.Metadata.AudioStreams}} |
| 98 | <dt>Audio</dt> |
| 99 | <dd> |
| 100 | {{.Codec}} |
| 101 | {{if .Language}}[{{.Language}}]{{end}} |
| 102 | {{if .SampleRate}}, {{.SampleRate}} Hz{{end}} |
| 103 | {{if .ChannelLayout}}, {{.ChannelLayout}}{{else if .Channels}}, {{.Channels}} channels{{end}} |
| 104 | {{if .SampleFormat}}, {{.SampleFormat}}{{end}} |
| 105 | {{if .Bitrate}}, {{.Bitrate}} kbps{{end}} |
| 106 | </dd> |
| 107 | {{end}} |
| 108 | |
| 109 | {{range .Data.Metadata.SubtitleStreams}} |
| 110 | <dt>Subtitle</dt> |
| 111 | <dd> |
| 112 | {{.Codec}} |
| 113 | {{if .Language}}[{{.Language}}]{{end}} |
| 114 | {{if .Title}}- {{.Title}}{{end}} |
| 115 | </dd> |
| 116 | {{end}} |
| 117 | |
| 118 | {{if .Data.Metadata.FileSize}} |
| 119 | <dt>File Size</dt> |
| 120 | <dd>{{formatFileSize .Data.Metadata.FileSize}}</dd> |
| 121 | {{end}} |
| 122 | {{end}} |
| 123 | </dl> |
| 124 | </details> |
| 125 | </div> |
| 126 | </div> |
| 127 | {{end}} |
| 128 |