parent
4d32422bd6
commit
ce9351d9a6
4 changed files with 574 additions and 271 deletions
|
@ -12,6 +12,7 @@ use std::path::PathBuf;
|
|||
pub struct YouTubeMeta {
|
||||
pub id: String,
|
||||
pub title: String,
|
||||
pub description: String,
|
||||
pub uploader_name: String,
|
||||
pub uploader_id: String,
|
||||
pub views: i64,
|
||||
|
@ -70,6 +71,13 @@ impl Video {
|
|||
.unwrap()
|
||||
}
|
||||
|
||||
pub async fn youtube_meta(&self) -> Option<YouTubeMeta> {
|
||||
if let Some(meta) = self.youtube_id.as_ref().map(|id| YouTubeMeta::get(id)) {
|
||||
return meta.await;
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub async fn has_path(path: &str) -> bool {
|
||||
sqlx::query("SELECT id FROM videos WHERE path = $1")
|
||||
.bind(path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue