Download videos from oldest to newest

This commit is contained in:
Sebastiaan de Schaetzen 2025-02-07 12:09:21 +01:00
parent 27e365de27
commit e4630565fd

View File

@ -43,7 +43,7 @@ func DownloadAllVideos(db *sql.DB) error {
log.Printf("Starting downloads...")
for {
// Fetch the next record from the database
row := db.QueryRow("select id, url, `cast`, title, description, upload_date, thumbnail from videos where state = 'pending' limit 1")
row := db.QueryRow("select id, url, `cast`, title, description, upload_date, thumbnail from videos where state = 'pending' order by id desc limit 1")
var id int
var href, cast, title, description, uploadDateStr, thumbnailUrl string
err = row.Scan(&id, &href, &cast, &title, &description, &uploadDateStr, &thumbnailUrl)