Things idk
This commit is contained in:
		
							parent
							
								
									3d9c12959d
								
							
						
					
					
						commit
						b1c8417b0f
					
				
							
								
								
									
										6
									
								
								DEV.md
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								DEV.md
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -1 +1,5 @@
 | 
			
		|||
listen along feature using ws and or p2p, downloading music when connectedd if you dont have it, matched by either the url, or a global id set by server
 | 
			
		||||
[ ] listen along feature using ws and or p2p, downloading music when connectedd if you dont have it, matched by either the url, or a global id set by server
 | 
			
		||||
[ ] Internationalisation
 | 
			
		||||
[ ] Music Player
 | 
			
		||||
[ ] Playlist exporting to folder, zip, tar balls, etc
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								assets/burger_menu.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								assets/burger_menu.svg
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#FFFFFF"><path shape-rendering="crispEdges" d="M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z"/></svg>
 | 
			
		||||
| 
		 After Width: | Height: | Size: 223 B  | 
							
								
								
									
										39
									
								
								assets/plus.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								assets/plus.svg
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,39 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 | 
			
		||||
<svg
 | 
			
		||||
   height="24px"
 | 
			
		||||
   viewBox="0 -960 960 960"
 | 
			
		||||
   width="24px"
 | 
			
		||||
   fill="#FFFFFF"
 | 
			
		||||
   version="1.1"
 | 
			
		||||
   id="svg1"
 | 
			
		||||
   sodipodi:docname="plus.svg"
 | 
			
		||||
   inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
 | 
			
		||||
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
 | 
			
		||||
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
 | 
			
		||||
   xmlns="http://www.w3.org/2000/svg"
 | 
			
		||||
   xmlns:svg="http://www.w3.org/2000/svg">
 | 
			
		||||
  <defs
 | 
			
		||||
     id="defs1" />
 | 
			
		||||
  <sodipodi:namedview
 | 
			
		||||
     id="namedview1"
 | 
			
		||||
     pagecolor="#000000"
 | 
			
		||||
     bordercolor="#000000"
 | 
			
		||||
     borderopacity="0.25"
 | 
			
		||||
     inkscape:showpageshadow="2"
 | 
			
		||||
     inkscape:pageopacity="0.0"
 | 
			
		||||
     inkscape:pagecheckerboard="0"
 | 
			
		||||
     inkscape:deskcolor="#d1d1d1"
 | 
			
		||||
     inkscape:zoom="45.254834"
 | 
			
		||||
     inkscape:cx="7.4025241"
 | 
			
		||||
     inkscape:cy="12.396466"
 | 
			
		||||
     inkscape:window-width="1898"
 | 
			
		||||
     inkscape:window-height="1037"
 | 
			
		||||
     inkscape:window-x="10"
 | 
			
		||||
     inkscape:window-y="10"
 | 
			
		||||
     inkscape:window-maximized="1"
 | 
			
		||||
     inkscape:current-layer="svg1" />
 | 
			
		||||
  <path 
 | 
			
		||||
     shape-rendering="crispEdges"
 | 
			
		||||
     d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"
 | 
			
		||||
     id="path1" />
 | 
			
		||||
</svg>
 | 
			
		||||
| 
		 After Width: | Height: | Size: 1.1 KiB  | 
| 
						 | 
				
			
			@ -121,6 +121,15 @@ impl SongCacheDl {
 | 
			
		|||
                    cache.current_jobs -= 1;
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
            SourceType::HttpBare => {
 | 
			
		||||
                todo!() 
 | 
			
		||||
            }
 | 
			
		||||
            SourceType::Http7z => {
 | 
			
		||||
                todo!()
 | 
			
		||||
            }
 | 
			
		||||
            SourceType::HttpZip => {
 | 
			
		||||
                todo!()
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        Ok(())
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,13 +32,19 @@ impl CompUi for SongListNav {
 | 
			
		|||
            }
 | 
			
		||||
 | 
			
		||||
            ui.with_layout(egui::Layout::right_to_left(egui::Align::RIGHT), |ui| {
 | 
			
		||||
                let img = ui.add(
 | 
			
		||||
                let download_all = ui.add(
 | 
			
		||||
                    egui::Image::new(crate::data::DL_ICON)
 | 
			
		||||
                        .tint(theme.accent_color)
 | 
			
		||||
                        .sense(egui::Sense::click())
 | 
			
		||||
                        .fit_to_exact_size(egui::Vec2::new(16.0, 16.0))
 | 
			
		||||
                );
 | 
			
		||||
                if img.clicked() {
 | 
			
		||||
                let add_song = ui.add(
 | 
			
		||||
                    egui::Image::new(crate::data::PLUS_ICON)
 | 
			
		||||
                        .tint(theme.accent_color)
 | 
			
		||||
                        .sense(egui::Sense::click())
 | 
			
		||||
                        .fit_to_exact_size(egui::Vec2::new(16.0, 16.0))
 | 
			
		||||
                );
 | 
			
		||||
                if download_all.clicked() {
 | 
			
		||||
                    let songs: Vec<_>;
 | 
			
		||||
                    match pid {
 | 
			
		||||
                        Some(pid) => {
 | 
			
		||||
| 
						 | 
				
			
			@ -60,6 +66,10 @@ impl CompUi for SongListNav {
 | 
			
		|||
                        ToastType::Info
 | 
			
		||||
                    );
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if add_song.clicked() {
 | 
			
		||||
                    todo!()
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
        Ok(()) 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,8 @@ pub const DL_ICON: egui::ImageSource  = egui::include_image!("../../assets/downl
 | 
			
		|||
pub const INFO_ICON: egui::ImageSource  = egui::include_image!("../../assets/info.svg");
 | 
			
		||||
pub const WARN_ICON: egui::ImageSource  = egui::include_image!("../../assets/warning.svg");
 | 
			
		||||
pub const ERROR_ICON: egui::ImageSource  = egui::include_image!("../../assets/error.svg");
 | 
			
		||||
pub const PLUS_ICON: egui::ImageSource  = egui::include_image!("../../assets/plus.svg");
 | 
			
		||||
pub const BURGER_ICON: egui::ImageSource  = egui::include_image!("../../assets/burger_menu.svg");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
pub const C_WARN: egui::Color32 = egui::Color32::from_rgb(255, 183, 0); // #ffb700
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
use std::str::FromStr;
 | 
			
		||||
use std::{path::PathBuf, str::FromStr};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -11,16 +11,16 @@ pub struct Song {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
impl Song {
 | 
			
		||||
    pub fn new(url: &url::Url) -> crate::Result<Self> {
 | 
			
		||||
    pub fn new(url: &url::Url, source_type: SourceType) -> crate::Result<Self> {
 | 
			
		||||
        Ok(Self {
 | 
			
		||||
            name: String::default(),
 | 
			
		||||
            author: String::default(),
 | 
			
		||||
            source_type: SourceType::from_url(url)?,
 | 
			
		||||
            source_type,
 | 
			
		||||
            url: url.clone()
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
    pub fn new_from_str(url: &str) -> crate::Result<Self> {
 | 
			
		||||
        Self::new(&url::Url::from_str(url)?)
 | 
			
		||||
    pub fn new_from_str(url: &str, source_type: SourceType) -> crate::Result<Self> {
 | 
			
		||||
        Self::new(&url::Url::from_str(url)?, source_type)
 | 
			
		||||
    }
 | 
			
		||||
    pub fn name(&self) -> &str {
 | 
			
		||||
        &self.name
 | 
			
		||||
| 
						 | 
				
			
			@ -48,21 +48,26 @@ impl Song {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, PartialOrd)]
 | 
			
		||||
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize, PartialEq, PartialOrd)]
 | 
			
		||||
pub enum SourceType {
 | 
			
		||||
    Youtube,
 | 
			
		||||
    Spotify,
 | 
			
		||||
    Soundcloud,
 | 
			
		||||
    HttpBare,
 | 
			
		||||
    HttpZip,
 | 
			
		||||
    Http7z
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl SourceType {
 | 
			
		||||
    fn from_url(url: &url::Url) -> crate::Result<Self> {
 | 
			
		||||
    fn from_url(url: &url::Url) -> Option<Self> {
 | 
			
		||||
        match url.host_str() {
 | 
			
		||||
            Some("youtube.com") | Some("youtu.be") => Ok(Self::Youtube),
 | 
			
		||||
            Some("open.spotify.com") => Ok(Self::Spotify),
 | 
			
		||||
            Some("soundcloud.com") |Some("on.soundcloud.com") => Ok(Self::Soundcloud),
 | 
			
		||||
            Some(host) => anyhow::bail!("Unknown host {host:?}"),
 | 
			
		||||
            None => anyhow::bail!("Unknown host: (none)"),
 | 
			
		||||
            Some("youtube.com") | Some("youtu.be") => 
 | 
			
		||||
                Some(Self::Youtube),
 | 
			
		||||
            Some("open.spotify.com") => 
 | 
			
		||||
                Some(Self::Spotify),
 | 
			
		||||
            Some("soundcloud.com") | Some("on.soundcloud.com") => 
 | 
			
		||||
                Some(Self::Soundcloud),
 | 
			
		||||
            _ => None
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user