about summary refs log tree commit diff stats
path: root/src/storage
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-23 09:06:06 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-23 09:06:06 +0200
commitf497dd5581358fc6e8fdd895500eea4141dd1519 (patch)
tree65bbeaaee030d08431e95644b57dd510b698aee6 /src/storage
parentfeat(cli): Add an explicit `subs export` subcommand (diff)
downloadyt-f497dd5581358fc6e8fdd895500eea4141dd1519.tar.gz
yt-f497dd5581358fc6e8fdd895500eea4141dd1519.zip
fix(storage/downloader): Sort the next videos to be downloaded like in the selection file
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/video_database/downloader.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/storage/video_database/downloader.rs b/src/storage/video_database/downloader.rs
index a7f6cad..c2c148d 100644
--- a/src/storage/video_database/downloader.rs
+++ b/src/storage/video_database/downloader.rs
@@ -24,12 +24,13 @@ use super::{ExtractorHash, Video};
 pub async fn get_next_uncached_video(app: &App) -> Result<Option<Video>> {
     let status = VideoStatus::Watch.as_db_integer();
 
+    // NOTE: The ORDER BY statement should be the same as the one in [`getters::get_videos`].<2024-08-22>
     let result = query!(
         r#"
         SELECT *
         FROM videos
         WHERE status = ? AND cache_path IS NULL
-        ORDER BY priority ASC
+        ORDER BY priority DESC, publish_date DESC
         LIMIT 1;
     "#,
         status