From 54536bfa3c3311717cb50ee43cef2e1c39373cd8 Mon Sep 17 00:00:00 2001 From: Carl Pearson Date: Mon, 14 Oct 2024 05:58:03 -0600 Subject: [PATCH] Header --- handlers.go | 12 ++++++++---- media/models.go | 17 +++++++++-------- static/style/common.css | 2 +- static/style/header.css | 35 +++++++++++++++++++++++++++++++++++ templates/download.html | 2 ++ templates/header.html | 16 ++++++++++++++++ templates/video.html | 4 ++-- templates/videos.html | 2 ++ 8 files changed, 75 insertions(+), 15 deletions(-) create mode 100644 static/style/header.css create mode 100644 templates/header.html diff --git a/handlers.go b/handlers.go index 5f8f08b..ae3a377 100644 --- a/handlers.go +++ b/handlers.go @@ -651,11 +651,13 @@ func startDownload(originalID uint, videoURL string, audioOnly bool) { } audio := media.Audio{ + MediaFile: media.MediaFile{ + Length: mediaMeta.length, + Size: mediaMeta.size, + }, OriginalID: originalID, Filename: dlFilename, Source: "original", - Length: mediaMeta.length, - Size: mediaMeta.size, } fmt.Println("create Audio", audio) if db.Create(&audio).Error != nil { @@ -672,14 +674,16 @@ func startDownload(originalID uint, videoURL string, audioOnly bool) { } video := media.Video{ + MediaFile: media.MediaFile{ + Length: mediaMeta.length, + Size: mediaMeta.size, + }, OriginalID: originalID, Filename: dlFilename, Source: "original", FPS: mediaMeta.fps, Width: mediaMeta.width, Height: mediaMeta.height, - Length: mediaMeta.length, - Size: mediaMeta.size, } log.Debugln("create Video", video) if db.Create(&video).Error != nil { diff --git a/media/models.go b/media/models.go index 0e34978..c8995ee 100644 --- a/media/models.go +++ b/media/models.go @@ -11,30 +11,31 @@ const ( Failed Status = "failed" ) +type MediaFile struct { + Size int64 + Length float64 + Type string + Codec string +} + type Audio struct { gorm.Model + MediaFile OriginalID uint // Original.ID Source string // "original", "transcode" Bps uint - Length float64 - Size int64 - Type string - Codec string Filename string Status Status } type Video struct { gorm.Model + MediaFile OriginalID uint // Original.ID Source string // "original", "transcode" Filename string Width uint Height uint FPS float64 - Length float64 - Size int64 - Type string - Codec string Status Status } diff --git a/static/style/common.css b/static/style/common.css index 1b1964c..8666d52 100644 --- a/static/style/common.css +++ b/static/style/common.css @@ -1,7 +1,7 @@ body { font-family: Arial, sans-serif; margin: 0; - padding: 20px; + padding: 0; box-sizing: border-box; } diff --git a/static/style/header.css b/static/style/header.css new file mode 100644 index 0000000..6e78858 --- /dev/null +++ b/static/style/header.css @@ -0,0 +1,35 @@ +header { + background-color: #333; + color: white; + padding: 1rem; + width: 100dvw; + box-sizing: border-box; +} + +nav { + display: flex; + justify-content: space-between; + align-items: center; +} + +.logo { + font-size: 1.5rem; + font-weight: bold; +} + +.nav-links { + list-style: none; + display: flex; + gap: 1rem; + margin: 0; + padding: 0; +} + +.nav-links a { + color: white; + text-decoration: none; +} + +.nav-links a:hover { + text-decoration: underline; +} \ No newline at end of file diff --git a/templates/download.html b/templates/download.html index 5254337..145f568 100644 --- a/templates/download.html +++ b/templates/download.html @@ -6,11 +6,13 @@ + {{template "header-css" .}} {{template "footer-css" .}} Download Video + {{template "header" .}}

Download Video

diff --git a/templates/header.html b/templates/header.html new file mode 100644 index 0000000..f13a6b2 --- /dev/null +++ b/templates/header.html @@ -0,0 +1,16 @@ +{{define "header"}} +
+ +
+{{end}} + +{{define "header-css"}} + +{{end}} \ No newline at end of file diff --git a/templates/video.html b/templates/video.html index 90287d9..6f978d8 100644 --- a/templates/video.html +++ b/templates/video.html @@ -8,13 +8,13 @@ + {{template "header-css" .}} {{template "footer-css" .}} - + {{template "header" .}}

{{.original.Title}}

-
{{range .videos}}
diff --git a/templates/videos.html b/templates/videos.html index b863851..4da6e75 100644 --- a/templates/videos.html +++ b/templates/videos.html @@ -9,10 +9,12 @@ + {{template "header-css" .}} {{template "footer-css" .}} + {{template "header" .}}

Downloaded Videos