ytdl-web/app/views/download.html

57 lines
2.2 KiB
HTML
Raw Normal View History

2023-04-14 16:07:57 -04:00
<div class="d-flex flex-column align-items-center">
<h1>Download Video</h1>
<h2 class="fs-4 text-muted text-center">{{.Meta.Title}}</h2>
2023-04-14 16:07:57 -04:00
<p style="font-size: 0.85rem">{{.Url}}</p>
<a href="{{.BasePath}}/" hx-get="{{.BasePath}}/" hx-trigger="click" hx-target="#main-content"
class="btn btn-secondary btn-sm mt-3" style="width: 30rem; max-width: 100%">
2023-04-14 22:01:36 -04:00
Download Another Video
2023-08-14 18:14:08 -04:00
</a>
2023-04-14 16:07:57 -04:00
</div>
2023-04-14 22:01:36 -04:00
{{$root := .}}
{{range $vidIndex, $video := .Videos}}
{{if not (eq $vidIndex 0)}}
<hr class="mt-5" />
{{end}}
<div class="d-flex flex-column flex-lg-row justify-content-center gap-5 mt-5">
<div class="d-flex justify-content-center">
<img src="{{.Meta.Thumbnail}}" alt="{{.Meta.Title}}" style="max-height: 25rem; max-width: 100%; margin: 0 auto" />
</div>
<div class="downloads flex-lg-grow-1">
{{range $index, $format := $video.Formats}}
{{template "format" (map "root" $root "format" $format "label" $format.Format "vidIndex" $vidIndex)}}
{{end}}
2023-04-14 16:07:57 -04:00
</div>
</div>
{{if gt (len $video.OtherFormats) 0}}
<div class="d-grid my-3">
<button class="btn btn-secondary" data-bs-toggle="collapse"
data-bs-target="#{{$root.Meta.ID}}-{{$vidIndex}}-collapse">
See More Formats
</button>
</div>
<div id="{{$root.Meta.ID}}-{{$vidIndex}}-collapse" class="collapse">
<div class="downloads d-flex d-md-grid flex-column">
{{range $index, $format := $video.OtherFormats}}
{{$label := sprintf "ext: %s, resolution: %s, filesize: %s, note: %s" $format.Ext $format.Resolution
(filesize $format.Filesize) $format.FormatNote}}
{{template "format" (map "root" $root "format" $format "label" $label "vidIndex" $vidIndex)}}
{{end}}
</div>
</div>
{{end}}
{{end}}
{{define "format"}}
<div style="font-size: smaller">{{.label}}</div>
<div class="flex-grow-1 d-flex gap-3">
<a class="btn btn-primary flex-grow-1" download="{{.root.Meta.ID}}-{{.format.Resolution}}.{{.format.Ext}}" P
href="{{.format.Url}}">
Download (direct)
</a>
<a class="btn btn-primary flex-grow-1" download="{{.root.Meta.ID}}-{{.format.Resolution}}.{{.format.Ext}}"
href="{{.root.BasePath}}/download/proxy?url={{queryEscape .root.Url}}&format={{.format.FormatID}}&index={{.vidIndex}}">
Download (proxied)
</a>
</div>
{{end}}