Header
This commit is contained in:
12
handlers.go
12
handlers.go
@@ -651,11 +651,13 @@ func startDownload(originalID uint, videoURL string, audioOnly bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
audio := media.Audio{
|
audio := media.Audio{
|
||||||
|
MediaFile: media.MediaFile{
|
||||||
|
Length: mediaMeta.length,
|
||||||
|
Size: mediaMeta.size,
|
||||||
|
},
|
||||||
OriginalID: originalID,
|
OriginalID: originalID,
|
||||||
Filename: dlFilename,
|
Filename: dlFilename,
|
||||||
Source: "original",
|
Source: "original",
|
||||||
Length: mediaMeta.length,
|
|
||||||
Size: mediaMeta.size,
|
|
||||||
}
|
}
|
||||||
fmt.Println("create Audio", audio)
|
fmt.Println("create Audio", audio)
|
||||||
if db.Create(&audio).Error != nil {
|
if db.Create(&audio).Error != nil {
|
||||||
@@ -672,14 +674,16 @@ func startDownload(originalID uint, videoURL string, audioOnly bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
video := media.Video{
|
video := media.Video{
|
||||||
|
MediaFile: media.MediaFile{
|
||||||
|
Length: mediaMeta.length,
|
||||||
|
Size: mediaMeta.size,
|
||||||
|
},
|
||||||
OriginalID: originalID,
|
OriginalID: originalID,
|
||||||
Filename: dlFilename,
|
Filename: dlFilename,
|
||||||
Source: "original",
|
Source: "original",
|
||||||
FPS: mediaMeta.fps,
|
FPS: mediaMeta.fps,
|
||||||
Width: mediaMeta.width,
|
Width: mediaMeta.width,
|
||||||
Height: mediaMeta.height,
|
Height: mediaMeta.height,
|
||||||
Length: mediaMeta.length,
|
|
||||||
Size: mediaMeta.size,
|
|
||||||
}
|
}
|
||||||
log.Debugln("create Video", video)
|
log.Debugln("create Video", video)
|
||||||
if db.Create(&video).Error != nil {
|
if db.Create(&video).Error != nil {
|
||||||
|
@@ -11,30 +11,31 @@ const (
|
|||||||
Failed Status = "failed"
|
Failed Status = "failed"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type MediaFile struct {
|
||||||
|
Size int64
|
||||||
|
Length float64
|
||||||
|
Type string
|
||||||
|
Codec string
|
||||||
|
}
|
||||||
|
|
||||||
type Audio struct {
|
type Audio struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
|
MediaFile
|
||||||
OriginalID uint // Original.ID
|
OriginalID uint // Original.ID
|
||||||
Source string // "original", "transcode"
|
Source string // "original", "transcode"
|
||||||
Bps uint
|
Bps uint
|
||||||
Length float64
|
|
||||||
Size int64
|
|
||||||
Type string
|
|
||||||
Codec string
|
|
||||||
Filename string
|
Filename string
|
||||||
Status Status
|
Status Status
|
||||||
}
|
}
|
||||||
|
|
||||||
type Video struct {
|
type Video struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
|
MediaFile
|
||||||
OriginalID uint // Original.ID
|
OriginalID uint // Original.ID
|
||||||
Source string // "original", "transcode"
|
Source string // "original", "transcode"
|
||||||
Filename string
|
Filename string
|
||||||
Width uint
|
Width uint
|
||||||
Height uint
|
Height uint
|
||||||
FPS float64
|
FPS float64
|
||||||
Length float64
|
|
||||||
Size int64
|
|
||||||
Type string
|
|
||||||
Codec string
|
|
||||||
Status Status
|
Status Status
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 20px;
|
padding: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
35
static/style/header.css
Normal file
35
static/style/header.css
Normal file
@@ -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;
|
||||||
|
}
|
@@ -6,11 +6,13 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="/static/style/common.css">
|
<link rel="stylesheet" href="/static/style/common.css">
|
||||||
<link rel="stylesheet" href="/static/style/download.css">
|
<link rel="stylesheet" href="/static/style/download.css">
|
||||||
|
{{template "header-css" .}}
|
||||||
{{template "footer-css" .}}
|
{{template "footer-css" .}}
|
||||||
<title>Download Video</title>
|
<title>Download Video</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
{{template "header" .}}
|
||||||
<h1>Download Video</h1>
|
<h1>Download Video</h1>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input type="url" name="url" placeholder="Video URL" required>
|
<input type="url" name="url" placeholder="Video URL" required>
|
||||||
|
16
templates/header.html
Normal file
16
templates/header.html
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{{define "header"}}
|
||||||
|
<header>
|
||||||
|
<nav>
|
||||||
|
<div class="logo">yt-dlp Site</div>
|
||||||
|
<ul class="nav-links">
|
||||||
|
<li><a href="/videos">Videos</a></li>
|
||||||
|
<li><a href="/download">Download</a></li>
|
||||||
|
<li><a href="/logout">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{define "header-css"}}
|
||||||
|
<link rel="stylesheet" href="/static/style/header.css">
|
||||||
|
{{end}}
|
@@ -8,13 +8,13 @@
|
|||||||
<link rel="stylesheet" href="/static/style/common.css">
|
<link rel="stylesheet" href="/static/style/common.css">
|
||||||
<link rel="stylesheet" href="/static/style/video.css">
|
<link rel="stylesheet" href="/static/style/video.css">
|
||||||
<link rel="stylesheet" href="/static/style/media-card.css">
|
<link rel="stylesheet" href="/static/style/media-card.css">
|
||||||
|
{{template "header-css" .}}
|
||||||
{{template "footer-css" .}}
|
{{template "footer-css" .}}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
{{template "header" .}}
|
||||||
<h1>{{.original.Title}}</h1>
|
<h1>{{.original.Title}}</h1>
|
||||||
|
|
||||||
<div class="media-grid">
|
<div class="media-grid">
|
||||||
{{range .videos}}
|
{{range .videos}}
|
||||||
<div class="media-card">
|
<div class="media-card">
|
||||||
|
@@ -9,10 +9,12 @@
|
|||||||
<link rel="stylesheet" href="/static/style/common.css">
|
<link rel="stylesheet" href="/static/style/common.css">
|
||||||
<link rel="stylesheet" href="/static/style/videos.css">
|
<link rel="stylesheet" href="/static/style/videos.css">
|
||||||
<link rel="stylesheet" href="/static/style/video-card.css">
|
<link rel="stylesheet" href="/static/style/video-card.css">
|
||||||
|
{{template "header-css" .}}
|
||||||
{{template "footer-css" .}}
|
{{template "footer-css" .}}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
{{template "header" .}}
|
||||||
<h1>Downloaded Videos</h1>
|
<h1>Downloaded Videos</h1>
|
||||||
|
|
||||||
<div class="video-list">
|
<div class="video-list">
|
||||||
|
Reference in New Issue
Block a user