diff options
Diffstat (limited to 'src/storage/video_database')
-rw-r--r-- | src/storage/video_database/getters.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/storage/video_database/getters.rs b/src/storage/video_database/getters.rs index b912276..176ebbb 100644 --- a/src/storage/video_database/getters.rs +++ b/src/storage/video_database/getters.rs @@ -122,11 +122,6 @@ pub async fn get_videos( let real_videos: Vec<Video> = videos .iter() .map(|base| -> Result<Video> { - let thumbnail_url = if let Some(url) = base.get("thumbnail_url") { - Some(Url::parse(url)?) - } else { - None - }; Ok(Video { cache_path: base .get::<Option<String>, &str>("cache_path") @@ -145,7 +140,10 @@ pub async fn get_videos( .clone(), publish_date: base.get("publish_date"), status: VideoStatus::from_db_integer(base.get("status")), - thumbnail_url, + thumbnail_url: base + .get::<Option<String>, &str>("thumbnail_url") + .as_ref() + .map(|url| Url::parse(url).expect("Parsing this as url should always work")), title: base.get::<String, &str>("title").to_owned(), url: Url::parse(base.get("url")).expect("Parsing this as url should always work"), priority: base.get("priority"), |