parent
14483ceec4
commit
c816b5d790
2 changed files with 13 additions and 0 deletions
|
@ -159,6 +159,13 @@ impl Library {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn get_all_videos(&self) -> Vec<Video> {
|
||||||
|
sqlx::query_as("SELECT * FROM videos")
|
||||||
|
.fetch_all(&self.conn)
|
||||||
|
.await
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn get_newly_added(&self, n: i64) -> Vec<Video> {
|
pub async fn get_newly_added(&self, n: i64) -> Vec<Video> {
|
||||||
sqlx::query_as("SELECT * FROM videos ORDER BY date_added DESC LIMIT $1;")
|
sqlx::query_as("SELECT * FROM videos ORDER BY date_added DESC LIMIT $1;")
|
||||||
.bind(n)
|
.bind(n)
|
||||||
|
|
|
@ -35,6 +35,12 @@ async fn launch() -> _ {
|
||||||
library
|
library
|
||||||
.scan_dir(&Path::new(&dir_path.clone()).to_path_buf())
|
.scan_dir(&Path::new(&dir_path.clone()).to_path_buf())
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
// Ensure thumbnails
|
||||||
|
for video in library.get_all_videos().await {
|
||||||
|
log::info!("Ensure thumbnail for {} [{}]", video.title, video.id);
|
||||||
|
library.get_thumbnail(&video).await;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let cors = rocket_cors::CorsOptions {
|
let cors = rocket_cors::CorsOptions {
|
||||||
|
|
Loading…
Add table
Reference in a new issue