Skip to content

Commit

Permalink
improoved encoding algo
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirari04 committed Jan 23, 2024
1 parent 78c9190 commit c057daf
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions services/Encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,19 @@ func loadEncodingTasks() {

// AUDIOS
var encodingAudios []models.Audio
inits.DB.
Model(&models.Audio{}).
Preload("File").
Where(&models.Audio{
Encoding: false,
Ready: false,
Failed: false,
}, "Encoding", "Ready", "Failed").
Order("id ASC").
Limit(10).
Find(&encodingAudios)
if len(encodingSubs) < 10 {
inits.DB.
Model(&models.Audio{}).
Preload("File").
Where(&models.Audio{
Encoding: false,
Ready: false,
Failed: false,
}, "Encoding", "Ready", "Failed").
Order("id ASC").
Limit(10).
Find(&encodingAudios)
}

if len(encodingAudios) > 0 {
log.Printf("Loaded %v audios to encode", len(encodingAudios))
Expand All @@ -142,17 +144,19 @@ func loadEncodingTasks() {

// QUALITYS
var encodingQualitys []models.Quality
inits.DB.
Model(&models.Quality{}).
Preload("File").
Where(&models.Quality{
Encoding: false,
Ready: false,
Failed: false,
}, "Encoding", "Ready", "Failed").
Order("id ASC").
Limit(10).
Find(&encodingQualitys)
if len(encodingSubs) < 10 && len(encodingAudios) < 10 {
inits.DB.
Model(&models.Quality{}).
Preload("File").
Where(&models.Quality{
Encoding: false,
Ready: false,
Failed: false,
}, "Encoding", "Ready", "Failed").
Order("id ASC").
Limit(10).
Find(&encodingQualitys)
}

if len(encodingQualitys) > 0 {
log.Printf("Loaded %v qualitys to encode", len(encodingQualitys))
Expand Down

0 comments on commit c057daf

Please sign in to comment.