fix: fixed bug cause by file rearrange
This commit is contained in:
parent
36530b8b22
commit
0f4cf287e1
2 changed files with 7 additions and 6 deletions
|
@ -1,8 +1,8 @@
|
||||||
use id3::{Tag, TagLike};
|
use id3::{Tag, TagLike};
|
||||||
use std::path::PathBuf;
|
|
||||||
use scan_dir::ScanDir;
|
use scan_dir::ScanDir;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::message_types::{ItemTag};
|
use crate::message_types::ItemTag;
|
||||||
|
|
||||||
const SUPPORTED_FILETYPES: [&str; 1] = ["mp3"];
|
const SUPPORTED_FILETYPES: [&str; 1] = ["mp3"];
|
||||||
|
|
||||||
|
@ -78,12 +78,13 @@ impl Iterator for MusicScanner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Returns the music information from a filepath
|
/// Returns the music information from a filepath
|
||||||
pub fn get_tag(filepath: &PathBuf) -> Result<ItemTag, id3::Error> {
|
pub fn get_tag(filepath: &PathBuf) -> Result<ItemTag, id3::Error> {
|
||||||
let tag = Tag::read_from_path(filepath)?;
|
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();
|
output_tag.path = filepath.to_string_lossy().into_owned();
|
||||||
|
|
||||||
// Get a bunch of frames...
|
// Get a bunch of frames...
|
||||||
|
|
|
@ -12,12 +12,11 @@ use dirs_next;
|
||||||
use crate::db_operations::DatabaseRequest;
|
use crate::db_operations::DatabaseRequest;
|
||||||
pub mod db_operations;
|
pub mod db_operations;
|
||||||
pub mod file_operations;
|
pub mod file_operations;
|
||||||
pub mod server_handling;
|
|
||||||
pub mod message_types;
|
pub mod message_types;
|
||||||
|
pub mod server_handling;
|
||||||
|
|
||||||
use crate::message_types::{PartialTag, ServerResponse, UIRequest};
|
use crate::message_types::{PartialTag, ServerResponse, UIRequest};
|
||||||
|
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[command(author, version, about, long_about=None)]
|
#[command(author, version, about, long_about=None)]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
|
@ -103,6 +102,7 @@ fn main() {
|
||||||
let server = TcpListener::bind("127.0.0.1:9001").unwrap();
|
let server = TcpListener::bind("127.0.0.1:9001").unwrap();
|
||||||
|
|
||||||
let mut sockets = Vec::<WebSocket<TcpStream>>::new();
|
let mut sockets = Vec::<WebSocket<TcpStream>>::new();
|
||||||
|
println!("Listening on {}", server.local_addr().unwrap());
|
||||||
loop {
|
loop {
|
||||||
if let Ok((stream, addr)) = server.accept() {
|
if let Ok((stream, addr)) = server.accept() {
|
||||||
println!("New socket connected from: {}", addr);
|
println!("New socket connected from: {}", addr);
|
||||||
|
|
Loading…
Reference in a new issue