Do 480p, 96k transcodes first

This commit is contained in:
Carl Pearson
2024-09-15 06:03:50 -06:00
parent b198caaefc
commit 829668bb3f
3 changed files with 16 additions and 3 deletions

View File

@@ -43,3 +43,7 @@ Build and push this container to ghcr
* Create a "personal access token (classic)" with write:packages
* account > settings > developer settings > personal access tokens > tokens (classic) > generate new token (classic)
* Put that personal access token as the repository actions secret `GHCR_TOKEN`.
## Roadmap
- [ ] edit original metadata

View File

@@ -655,10 +655,14 @@ func videoHandler(c echo.Context) error {
}
var videos []Video
db.Where("original_id = ?", id).Find(&videos)
db.Where("original_id = ?", id).
Order("CASE WHEN source = 'original' THEN 0 ELSE 1 END, height ASC").
Find(&videos)
var audios []Audio
db.Where("original_id = ?", id).Find(&audios)
db.Where("original_id = ?", id).
Order("CASE WHEN source = 'original' THEN 0 ELSE 1 END, bps ASC").
Find(&audios)
dataDir := getDataDir()

View File

@@ -216,7 +216,12 @@ func transcodePending() {
// loop until no more pending jobs
for {
var trans Transcode
err := db.First(&trans, "status = ?", "pending").Error
err := db.Where("status = ?", "pending").
Order("CASE " +
"WHEN dst_kind = 'video' AND height = 480 THEN 0 " +
"WHEN dst_kind = 'audio' AND rate = 96 THEN 0 " +
"ELSE 1 END").First(&trans).Error
// err := db.First(&trans, "status = ?", "pending").Error
if err == gorm.ErrRecordNotFound {
fmt.Println("no pending transcode jobs")
break // no more pending jobs