fix: fixed bug cause by file rearrange

This commit is contained in:
Nickiel12 2022-12-21 19:18:42 -08:00
parent 36530b8b22
commit 0f4cf287e1
2 changed files with 7 additions and 6 deletions

View file

@ -1,8 +1,8 @@
use id3::{Tag, TagLike};
use std::path::PathBuf;
use scan_dir::ScanDir;
use std::path::PathBuf;
use crate::message_types::{ItemTag};
use crate::message_types::ItemTag;
const SUPPORTED_FILETYPES: [&str; 1] = ["mp3"];
@ -78,12 +78,13 @@ impl Iterator for MusicScanner {
}
}
/// Returns the music information from a filepath
pub fn get_tag(filepath: &PathBuf) -> Result<ItemTag, id3::Error> {
let tag = Tag::read_from_path(filepath)?;
let mut output_tag = ItemTag::new();
let mut output_tag = ItemTag {
..ItemTag::default()
};
output_tag.path = filepath.to_string_lossy().into_owned();
// Get a bunch of frames...

View file

@ -12,12 +12,11 @@ use dirs_next;
use crate::db_operations::DatabaseRequest;
pub mod db_operations;
pub mod file_operations;
pub mod server_handling;
pub mod message_types;
pub mod server_handling;
use crate::message_types::{PartialTag, ServerResponse, UIRequest};
#[derive(Parser, Debug)]
#[command(author, version, about, long_about=None)]
struct Cli {
@ -103,6 +102,7 @@ fn main() {
let server = TcpListener::bind("127.0.0.1:9001").unwrap();
let mut sockets = Vec::<WebSocket<TcpStream>>::new();
println!("Listening on {}", server.local_addr().unwrap());
loop {
if let Ok((stream, addr)) = server.accept() {
println!("New socket connected from: {}", addr);