Skip to content

Commit

Permalink
fix: Fix #171
Browse files Browse the repository at this point in the history
  • Loading branch information
Losses committed Dec 4, 2024
1 parent 00911c0 commit 6706092
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions native/hub/src/playback.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;

use anyhow::{Context, Result};
Expand Down Expand Up @@ -29,20 +30,20 @@ use crate::{
pub fn files_to_playback_request(
lib_path: &String,
files: &[database::entities::media_files::Model],
) -> std::vec::Vec<(i32, std::path::PathBuf)> {
) -> Vec<(i32, PathBuf)> {
files
.iter()
.map(|file| {
let file_path = canonicalize(
Path::new(lib_path)
.join(&file.directory)
.join(&file.file_name),
)
.unwrap();

(file.id, file_path)
.filter_map(|file| {
let file_path = Path::new(lib_path)
.join(&file.directory)
.join(&file.file_name);

match canonicalize(&file_path) {
Ok(canonical_path) => Some((file.id, canonical_path)),
Err(_) => None,
}
})
.collect::<Vec<_>>()
.collect()
}

pub async fn load_request(
Expand Down

0 comments on commit 6706092

Please sign in to comment.