Compare commits

...

5 Commits

Author SHA1 Message Date
de798246b9 ci: run every 2 days
All checks were successful
Build and Deploy ytdlp-site / build-deploy (push) Successful in 35s
2025-10-23 23:02:41 +00:00
1b9fb93cf6 Update .gitea/workflows/build-deploy.yml
All checks were successful
Build and Deploy ytdlp-site / build-deploy (push) Successful in 4m47s
2025-10-23 00:36:12 +00:00
667f2a88ba go.mod: 1.23.0 -> 1.24.5
All checks were successful
Build and Deploy ytdlp-site / build-deploy (push) Successful in 4m15s
Signed-off-by: Carl Pearson <me@carlpearson.net>
2025-10-06 05:46:45 -06:00
ee4be382b9 improve logging
Some checks failed
Build and Deploy ytdlp-site / build-deploy (push) Has been cancelled
Signed-off-by: Carl Pearson <me@carlpearson.net>
2025-10-06 05:44:54 -06:00
12137b1fa8 rate -> kbps
Signed-off-by: Carl Pearson <me@carlpearson.net>
2025-10-06 05:44:40 -06:00
4 changed files with 13 additions and 12 deletions

View File

@@ -5,9 +5,10 @@ on:
branches: [ master ] branches: [ master ]
pull_request: pull_request:
branches: [ master ] branches: [ master ]
workflow_dispatch:
schedule: schedule:
# Runs every Friday at 2:30 AM UTC # Runs every 2 days at 2:30 AM UTC
- cron: '30 2 * * 5' - cron: '30 2 */2 * *'
env: env:
SLUG: git.carlpearson.net/cwpearson/ytdlp-site SLUG: git.carlpearson.net/cwpearson/ytdlp-site
TZ: America/Denver TZ: America/Denver

4
go.mod
View File

@@ -1,8 +1,8 @@
module ytdlp-site module ytdlp-site
go 1.23 go 1.24
toolchain go1.23.0 toolchain go1.24.5
require ( require (
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0

14
main.go
View File

@@ -1,7 +1,6 @@
package main package main
import ( import (
"fmt"
"html/template" "html/template"
"io" "io"
golog "log" golog "log"
@@ -95,24 +94,25 @@ func main() {
sqlDB.SetMaxOpenConns(1) sqlDB.SetMaxOpenConns(1)
// Migrate the schema // Migrate the schema
db.AutoMigrate(&originals.Original{}, &playlists.Playlist{}, if err := db.AutoMigrate(&originals.Original{}, &playlists.Playlist{},
&media.Video{}, &media.Audio{}, &media.VideoClip{}, &media.Video{}, &media.Audio{}, &media.VideoClip{},
&users.User{}, &TempURL{}, &transcodes.Transcode{}) &users.User{}, &TempURL{}, &transcodes.Transcode{}); err != nil {
log.Fatal(err)
}
database.Init(db, log) database.Init(db, log)
defer database.Fini() defer database.Fini()
err = handlers.Init(log) err = handlers.Init(log)
if err != nil { if err != nil {
panic(fmt.Sprintf("%v", err)) log.Fatal(err)
} }
defer handlers.Fini() defer handlers.Fini()
go PeriodicCleanup() go PeriodicCleanup()
// create a user // create a user
err = ensureAdminAccount(db) if err = ensureAdminAccount(db); err != nil {
if err != nil { log.Fatal("create admin account error:", err)
panic(fmt.Sprintf("failed to create admin user: %v", err))
} }
// Initialize Echo // Initialize Echo

View File

@@ -277,7 +277,7 @@ func cleanupTranscodes() {
err := db.Where("status = ?", "pending"). err := db.Where("status = ?", "pending").
Order("CASE " + Order("CASE " +
"WHEN dst_kind = 'video' AND height = 540 THEN 0 " + "WHEN dst_kind = 'video' AND height = 540 THEN 0 " +
"WHEN dst_kind = 'audio' AND rate = 96 THEN 0 " + "WHEN dst_kind = 'audio' AND kbps = 96 THEN 0 " +
"ELSE 1 END").First(&trans).Error "ELSE 1 END").First(&trans).Error
// err := db.First(&trans, "status = ?", "pending").Error // err := db.First(&trans, "status = ?", "pending").Error
if err == gorm.ErrRecordNotFound { if err == gorm.ErrRecordNotFound {