From 0f4cf287e1bbfacc47a4f8ed4d9c911bdc573be0 Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Wed, 21 Dec 2022 19:18:42 -0800 Subject: [PATCH] fix: fixed bug cause by file rearrange --- src/file_operations.rs | 9 +++++---- src/main.rs | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/file_operations.rs b/src/file_operations.rs index 443cad5..8ed908b 100644 --- a/src/file_operations.rs +++ b/src/file_operations.rs @@ -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 { 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... diff --git a/src/main.rs b/src/main.rs index 70418d6..39608be 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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::>::new(); + println!("Listening on {}", server.local_addr().unwrap()); loop { if let Ok((stream, addr)) = server.accept() { println!("New socket connected from: {}", addr);