Improved playlist handling

This commit is contained in:
Carl Pearson
2024-10-11 06:25:25 -06:00
parent 4b81dd46f2
commit 037e6279e6
15 changed files with 302 additions and 169 deletions

View File

@@ -12,45 +12,19 @@
</head>
<body>
<h1>Playlist</h1>
<h1>{{.playlist.Title}}</h1>
<h2>Playlist</h2>
<div class="video-list">
{{range .originals}}
<div class="video-card">
<div class="video-title">
{{if or (eq .Status "download completed") (eq .Status "transcoding") (eq .Status "completed")}}
<a href="/video/{{.ID}}">{{.Title}}</a>
{{else}}
{{.Title}}
{{end}}
</div>
<div class="video-info">{{.Artist}}</div>
<div class="video-info"><a href="{{.URL}}">{{.URL}}</a></div>
<div class="video-info">{{.Status}}</div>
<div class="video-info">
{{if .Audio}}
Audio
{{end}}
{{if .Video}}
Video
{{end}}
</div>
<div class="video-options">
{{if eq .Status "completed"}}
<form action="/video/{{.ID}}/process" method="post" style="display:inline;">
<button type="submit">Reprocess</button>
</form>
{{else if eq .Status "failed"}}
<form action="/video/{{.ID}}/restart" method="post" style="display:inline;">
<button type="submit">Restart</button>
</form>
{{else if eq .Status "downloading"}}
{{end}}
<form action="/video/{{.ID}}/delete" method="post" style="display:inline;">
<button type="submit">Delete</button>
</form>
</div>
</div>
{{range .unwatched}}
{{template "playlist-video-card-html" .}}
{{end}}
</div>
<h2>Watched</h2>
<div class="video-list">
{{range .watched}}
{{template "playlist-video-card-html" .}}
{{end}}
</div>

56
templates/video_card.html Normal file
View File

@@ -0,0 +1,56 @@
{{define "playlist-video-card-html"}}
<div class="video-card">
<div class="video-title">
{{if or (eq .Status "download completed") (eq .Status "transcoding") (eq .Status "completed")}}
<a href="/video/{{.ID}}">{{.Title}}</a>
{{else}}
{{.Title}}
{{end}}
</div>
<div class="video-info">{{.Artist}}</div>
<div class="video-info"><a href="{{.URL}}">{{.URL}}</a></div>
<div class="video-info">{{.Status}}</div>
<div class="video-info">
{{if .Audio}}
Audio
{{end}}
{{if .Video}}
Video
{{end}}
</div>
<div class="video-options">
{{if or (eq .Status "completed") (eq .Status "not started")}}
<form action="/video/{{.ID}}/toggle_watched" method="post" style="display:inline;">
<button type="submit">
{{ if .Watched }}
Not Watched
{{ else }}
Watched
{{ end }}
</button>
</form>
{{end}}
{{if eq .Status "completed"}}
<form action="/video/{{.ID}}/process" method="post" style="display:inline;">
<button type="submit">Reprocess</button>
</form>
{{else if eq .Status "failed"}}
<form action="/video/{{.ID}}/restart" method="post" style="display:inline;">
<button type="submit">Restart</button>
</form>
{{end}}
{{if eq .Status "not started"}}
<form action="/video/{{.ID}}/restart" method="post" style="display:inline;">
<button type="submit">Start</button>
</form>
{{end}}
<form action="/video/{{.ID}}/delete" method="post" style="display:inline;">
<button type="submit">Delete</button>
</form>
</div>
</div>
{{end}}
{{define "playlist-video-card-css"}}
<!-- <link rel="stylesheet" href="/static/style/footer.css"> -->
{{end}}

View File

@@ -65,17 +65,8 @@
{{.Title}}
{{end}}
</div>
<div class="video-info"><a href="{{.URL}}">{{.URL}}</a></div>
<div class="video-options">
{{if eq .Status "completed"}}
<form action="/p/{{.ID}}/process" method="post" style="display:inline;">
<button type="submit">Reprocess</button>
</form>
{{else if eq .Status "failed"}}
<form action="/p/{{.ID}}/restart" method="post" style="display:inline;">
<button type="submit">Restart</button>
</form>
{{else if eq .Status "downloading"}}
{{end}}
<form action="/p/{{.ID}}/delete" method="post" style="display:inline;">
<button type="submit">Delete</button>
</form>