Fixed warnings from cargo
This commit is contained in:
		
							parent
							
								
									6e70d38f7f
								
							
						
					
					
						commit
						33ca4502e4
					
				| 
						 | 
				
			
			@ -11,8 +11,8 @@ cargo build --release --target x86_64-pc-windows-gnu
 | 
			
		|||
cargo build --release --target x86_64-unknown-linux-gnu
 | 
			
		||||
cargo build --release --target aarch64-unknown-linux-gnu
 | 
			
		||||
 | 
			
		||||
cp ./target/x86_64-pc-windows-gnu/release/mcmg.exe ./target/mcmg_win32.exe
 | 
			
		||||
cp ./target/x86_64-unknown-linux-gnu/release/mcmg ./target/mcmg_linux_x86_64
 | 
			
		||||
cp ./target/aarch64-unknown-linux-gnu/release/mcmg ./target/mcmg_linux_aarch64
 | 
			
		||||
strip --strip-unneeded ./target/x86_64-pc-windows-gnu/release/mcmg.exe -o ./target/mcmg_win32.exe
 | 
			
		||||
strip --strip-unneeded ./target/x86_64-unknown-linux-gnu/release/mcmg  -o ./target/mcmg_linux_x86_64
 | 
			
		||||
aarch64-linux-gnu-strip --strip-unneeded ./target/aarch64-unknown-linux-gnu/release/mcmg -o ./target/mcmg_linux_aarch64
 | 
			
		||||
cp ./scripts/setup-template.sh  "./target/mcmg-setup-$1.sh"
 | 
			
		||||
cp ./scripts/setup-template.ps1 "./target/mcmg-setup-$1.ps1"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,14 +1,11 @@
 | 
			
		|||
mod nav_bar;
 | 
			
		||||
mod song_edit_window;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
use std::collections::HashSet;
 | 
			
		||||
 | 
			
		||||
use egui::{Button, Color32, Label, RichText, Sense};
 | 
			
		||||
use egui::{Color32, RichText};
 | 
			
		||||
use egui_extras::{Column, TableBuilder};
 | 
			
		||||
use song_edit_window::{GuiError, GuiImportPlaylist, GuiNewSong};
 | 
			
		||||
 | 
			
		||||
use crate::{config::{Config, ConfigWrapper}, downloader::Downloader, manifest::{song::{Song, SongType}, Manifest}};
 | 
			
		||||
use crate::{config::ConfigWrapper, downloader::Downloader, manifest::{song::{Song, SongType}, Manifest}};
 | 
			
		||||
 | 
			
		||||
use self::song_edit_window::GuiSongEditor;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,5 @@
 | 
			
		|||
use egui::Hyperlink;
 | 
			
		||||
 | 
			
		||||
use super::Gui;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
impl Gui {
 | 
			
		||||
 | 
			
		||||
    pub fn draw_nav(&mut self, ctx: &egui::Context, _: &mut eframe::Frame) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,10 +1,7 @@
 | 
			
		|||
 | 
			
		||||
use std::sync::Arc;
 | 
			
		||||
 | 
			
		||||
use egui::{text::{LayoutJob, TextWrapping}, Color32, Label, RichText, Style, TextBuffer, TextFormat, TextStyle};
 | 
			
		||||
use egui::{Color32, Label, RichText};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
use crate::manifest::{playlist::Playlist, song::{Song, SongType}};
 | 
			
		||||
use crate::manifest::song::{Song, SongType};
 | 
			
		||||
 | 
			
		||||
use super::Gui;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,8 +13,6 @@ use serde::{Deserialize, Serialize};
 | 
			
		|||
const DEFAULT_MANIFEST: &'static str = include_str!("../../manifest.default.json");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
pub type SongName = String;
 | 
			
		||||
pub type Genre = HashMap<SongName, song::Song>;
 | 
			
		||||
 | 
			
		||||
#[allow(non_camel_case_types)]
 | 
			
		||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
 | 
			
		||||
| 
						 | 
				
			
			@ -43,7 +41,7 @@ impl Manifest {
 | 
			
		|||
    pub fn get_format(&self) -> &Format {
 | 
			
		||||
        &self.format
 | 
			
		||||
    }
 | 
			
		||||
    pub fn add_song(&mut self, playlist_name: &String, name: SongName, song: Song) -> Option<Song> {
 | 
			
		||||
    pub fn add_song(&mut self, playlist_name: &String, name: String, song: Song) -> Option<Song> {
 | 
			
		||||
        self.get_playlist_mut(playlist_name)?.add_song(name, song)
 | 
			
		||||
    }
 | 
			
		||||
    pub fn get_song(&self, playlist_name: &String, name: &String) -> Option<&Song> {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,9 +13,6 @@ pub struct Playlist {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
impl Playlist {
 | 
			
		||||
    pub fn new() -> Self {
 | 
			
		||||
        Self { ..Default::default() }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn add_song(&mut self, name: String, song: Song) -> Option<Song> {
 | 
			
		||||
        self.songs.insert(name, song)
 | 
			
		||||
| 
						 | 
				
			
			@ -33,6 +30,7 @@ impl Playlist {
 | 
			
		|||
        &self.songs
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    #[allow(dead_code)]
 | 
			
		||||
    pub fn get_songs_mut(&mut self) -> &mut HashMap<String, Song> {
 | 
			
		||||
        &mut self.songs
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,22 +1,21 @@
 | 
			
		|||
use std::{collections::HashMap, io::Write};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
pub(crate) fn simple_prompt(p: &str) -> String {
 | 
			
		||||
 | 
			
		||||
    print!("{c}prompt{r}: {p} > ",
 | 
			
		||||
        c=anstyle::AnsiColor::Cyan.render_fg(),
 | 
			
		||||
        r=anstyle::Reset.render()
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    // I dont care if it fails
 | 
			
		||||
    let _ = std::io::stdout().flush();
 | 
			
		||||
    
 | 
			
		||||
    let mut buf = String::new();
 | 
			
		||||
    let _ = std::io::stdin().read_line(&mut buf);
 | 
			
		||||
 | 
			
		||||
    buf.trim().to_string()
 | 
			
		||||
}
 | 
			
		||||
//pub(crate) fn simple_prompt(p: &str) -> String {
 | 
			
		||||
//
 | 
			
		||||
//    print!("{c}prompt{r}: {p} > ",
 | 
			
		||||
//        c=anstyle::AnsiColor::Cyan.render_fg(),
 | 
			
		||||
//        r=anstyle::Reset.render()
 | 
			
		||||
//    );
 | 
			
		||||
//
 | 
			
		||||
//    // I dont care if it fails
 | 
			
		||||
//    let _ = std::io::stdout().flush();
 | 
			
		||||
//    
 | 
			
		||||
//    let mut buf = String::new();
 | 
			
		||||
//    let _ = std::io::stdin().read_line(&mut buf);
 | 
			
		||||
//
 | 
			
		||||
//    buf.trim().to_string()
 | 
			
		||||
//}
 | 
			
		||||
 | 
			
		||||
#[allow(dead_code)]
 | 
			
		||||
pub(crate) fn prompt_with_list(p: &str, options: &[&str]) -> usize {
 | 
			
		||||
| 
						 | 
				
			
			@ -47,33 +46,33 @@ pub(crate) fn prompt_with_list(p: &str, options: &[&str]) -> usize {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub(crate) fn prompt_with_list_or_str(p: &str, options: &[String]) -> String {
 | 
			
		||||
    println!("{c}prompt{r}: {p} (select with number or input text)",
 | 
			
		||||
        c=anstyle::AnsiColor::Cyan.render_fg(),
 | 
			
		||||
        r=anstyle::Reset.render()
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    for (i, op) in options.iter().enumerate() {
 | 
			
		||||
        println!("    - {}: {}", i, op);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    print!("> ");
 | 
			
		||||
    // I dont care if it fails
 | 
			
		||||
    let _ = std::io::stdout().flush();
 | 
			
		||||
    
 | 
			
		||||
    let mut buf = String::new();
 | 
			
		||||
    let _ = std::io::stdin().read_line(&mut buf);
 | 
			
		||||
 | 
			
		||||
    if let Ok(num) = buf.trim().parse::<usize>() {
 | 
			
		||||
        if let Some(g) = options.get(num) {
 | 
			
		||||
            return g.clone();
 | 
			
		||||
        } else {
 | 
			
		||||
            return prompt_with_list_or_str(p, options);
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        return buf.trim().to_string();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
// pub(crate) fn prompt_with_list_or_str(p: &str, options: &[String]) -> String {
 | 
			
		||||
//     println!("{c}prompt{r}: {p} (select with number or input text)",
 | 
			
		||||
//         c=anstyle::AnsiColor::Cyan.render_fg(),
 | 
			
		||||
//         r=anstyle::Reset.render()
 | 
			
		||||
//     );
 | 
			
		||||
// 
 | 
			
		||||
//     for (i, op) in options.iter().enumerate() {
 | 
			
		||||
//         println!("    - {}: {}", i, op);
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     print!("> ");
 | 
			
		||||
//     // I dont care if it fails
 | 
			
		||||
//     let _ = std::io::stdout().flush();
 | 
			
		||||
//     
 | 
			
		||||
//     let mut buf = String::new();
 | 
			
		||||
//     let _ = std::io::stdin().read_line(&mut buf);
 | 
			
		||||
// 
 | 
			
		||||
//     if let Ok(num) = buf.trim().parse::<usize>() {
 | 
			
		||||
//         if let Some(g) = options.get(num) {
 | 
			
		||||
//             return g.clone();
 | 
			
		||||
//         } else {
 | 
			
		||||
//             return prompt_with_list_or_str(p, options);
 | 
			
		||||
//         }
 | 
			
		||||
//     } else {
 | 
			
		||||
//         return buf.trim().to_string();
 | 
			
		||||
//     }
 | 
			
		||||
// }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#[allow(dead_code)]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										12
									
								
								src/util.rs
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/util.rs
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -52,21 +52,11 @@ pub(crate) fn isatty() -> bool {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#[allow(dead_code)]
 | 
			
		||||
pub fn as_any_mut<T: Any>(val: &mut T) -> &mut dyn Any {
 | 
			
		||||
     val as &mut dyn Any
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// pub async fn dl_to_file(url: &str, p: PathBuf) -> anyhow::Result<()> {
 | 
			
		||||
//     log::info!("Downloading {} -> {:?}", url, p);
 | 
			
		||||
//     let ytdlp_req = reqwest::get(url).await?.bytes().await?;
 | 
			
		||||
//     log::debug!("Downloading {:?} finished, writing to file", p);
 | 
			
		||||
//     let mut fd = std::fs::File::create(&p)?;
 | 
			
		||||
//     fd.write(&ytdlp_req)?;
 | 
			
		||||
//     log::debug!("Finished writing {:?}", p);
 | 
			
		||||
//     Ok(())
 | 
			
		||||
// }
 | 
			
		||||
 | 
			
		||||
pub fn get_song_path/*<P: TryInto<PathBuf>>*/(/*basepath: Option<P>,*/ pname: &String, sname: &String, format: &Format) -> PathBuf {
 | 
			
		||||
    // let mut path: PathBuf;
 | 
			
		||||
    /*if let Some(bp) = basepath {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user