From 38b27c66c2e34730c20ccf1a50be35570be87032 Mon Sep 17 00:00:00 2001 From: G2-Games Date: Mon, 4 Dec 2023 22:33:52 -0600 Subject: [PATCH] Fixed GStreamer URI generation --- src/music_storage/music_db.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/music_storage/music_db.rs b/src/music_storage/music_db.rs index 3faf165..f66c8df 100644 --- a/src/music_storage/music_db.rs +++ b/src/music_storage/music_db.rs @@ -14,6 +14,7 @@ use rcue::parser::parse_from_file; use std::fs; use std::path::{Path, PathBuf}; use walkdir::WalkDir; +use glib::filename_to_uri; // Time use chrono::{serde::ts_milliseconds_option, DateTime, Utc}; @@ -224,8 +225,8 @@ impl URI { pub fn as_uri(&self) -> String { let path_str = match self { - URI::Local(location) => format!("file://{}", location.as_path().to_string_lossy()), - URI::Cue { location, .. } => format!("file://{}", location.as_path().to_string_lossy()), + URI::Local(location) => filename_to_uri(location, None).expect("couldn't convert path to URI").to_string(), + URI::Cue { location, .. } => filename_to_uri(location, None).expect("couldn't convert path to URI").to_string(), URI::Remote(_, location) => location.clone(), }; path_str.to_string()