download_form.html
| 1 | {{define "download_form"}} |
| 2 | <div class="page-header"> |
| 3 | <h2>Download</h2> |
| 4 | </div> |
| 5 | |
| 6 | <div class="download-form"> |
| 7 | <article> |
| 8 | <form method="post" action="/download"> |
| 9 | <label for="url">Video/Playlist URL</label> |
| 10 | <input type="url" id="url" name="url" placeholder="https://youtube.com/watch?v=..." required value="{{.Data.URL}}"> |
| 11 | |
| 12 | <label for="preset_id">Preset</label> |
| 13 | <select id="preset_id" name="preset_id"> |
| 14 | <option value="">-- No preset (manual) --</option> |
| 15 | {{range .Data.Presets}} |
| 16 | <option value="{{.ID}}" {{if $.Data.DefaultPreset}}{{if eq .ID $.Data.DefaultPreset.ID}}selected{{end}}{{end}}> |
| 17 | {{.Name}} {{if .IsDefault}}(default){{end}} |
| 18 | </option> |
| 19 | {{end}} |
| 20 | </select> |
| 21 | |
| 22 | <label for="output_dir">Output Directory</label> |
| 23 | <input type="text" id="output_dir" name="output_dir" placeholder="e.g., videos/music (relative to downloads folder)" value="{{.Data.OutputDir}}"> |
| 24 | <small>Optional sub-directory within the downloads folder. Use / for nested paths.</small> |
| 25 | |
| 26 | <label for="format_override">Format Override</label> |
| 27 | <input type="text" id="format_override" name="format_override" placeholder="e.g., bestvideo+bestaudio/best or format ID like 22" value="{{.Data.FormatOverride}}"> |
| 28 | <small>Overrides the preset format selection. Use yt-dlp format syntax or specific format IDs.</small> |
| 29 | |
| 30 | <label for="custom_flags">Custom Flags</label> |
| 31 | <textarea id="custom_flags" name="custom_flags" rows="3" placeholder="Any additional yt-dlp flags...">{{.Data.CustomFlags}}</textarea> |
| 32 | <small>Additional flags appended after preset flags. Example: --no-playlist --write-thumbnail</small> |
| 33 | |
| 34 | <div class="form-actions"> |
| 35 | <button type="submit" class="primary">Start Download</button> |
| 36 | <button type="submit" class="secondary" formaction="/download" formmethod="get" name="list_formats" value="1">List Available Formats</button> |
| 37 | </div> |
| 38 | </form> |
| 39 | </article> |
| 40 | |
| 41 | {{if .Data.ShowFormats}} |
| 42 | {{if .Data.Formats}} |
| 43 | <article> |
| 44 | <h4>Available Formats</h4> |
| 45 | <table> |
| 46 | <thead> |
| 47 | <tr> |
| 48 | <th>ID</th> |
| 49 | <th>Extension</th> |
| 50 | <th>Resolution</th> |
| 51 | <th>FPS</th> |
| 52 | <th>Note</th> |
| 53 | </tr> |
| 54 | </thead> |
| 55 | <tbody> |
| 56 | {{range .Data.Formats}} |
| 57 | <tr> |
| 58 | <td><code>{{.ID}}</code></td> |
| 59 | <td>{{.Ext}}</td> |
| 60 | <td>{{.Resolution}}</td> |
| 61 | <td>{{.FPS}}</td> |
| 62 | <td>{{.Note}}</td> |
| 63 | </tr> |
| 64 | {{end}} |
| 65 | </tbody> |
| 66 | </table> |
| 67 | </article> |
| 68 | {{else}} |
| 69 | <div class="empty-state"> |
| 70 | <p>No formats found. Check the URL and try again.</p> |
| 71 | </div> |
| 72 | {{end}} |
| 73 | {{end}} |
| 74 | </div> |
| 75 | {{end}} |
| 76 |