Compare commits
No commits in common. "e0201ccb50313ad6dd5b8c52409bdfad84d7a253" and "dfc55837ee627f8130ff6b75b07dcee32a395f78" have entirely different histories.
e0201ccb50
...
dfc55837ee
|
@ -19,6 +19,15 @@ jobs:
|
||||||
# - uses: actions-rust-lang/setup-rust-toolchain@v1
|
# - uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
# - run: cargo test
|
# - run: cargo test
|
||||||
|
|
||||||
|
#fmt:
|
||||||
|
# name: Rustfmt
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# - uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
# - run: rustup component add rustfmt
|
||||||
|
# - run: cargo fmt --all -- --check
|
||||||
|
|
||||||
clippy:
|
clippy:
|
||||||
name: Clippy
|
name: Clippy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -168,6 +168,10 @@ impl Downloader {
|
||||||
]);
|
]);
|
||||||
cmd
|
cmd
|
||||||
}
|
}
|
||||||
|
url => {
|
||||||
|
log::error!("Unknown or unsupported hostname '{:?}'", url);
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if log::max_level() < Level::Debug {
|
if log::max_level() < Level::Debug {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use egui::{Color32, RichText};
|
use egui::{Color32, RichText, TextBuffer};
|
||||||
|
|
||||||
use crate::ui::gui::{components::ComponentContextMenu, windows::{self, WindowIndex}};
|
use crate::ui::gui::{components::ComponentContextMenu, windows::{self, WindowIndex}};
|
||||||
|
|
||||||
|
@ -15,14 +15,14 @@ impl ComponentContextMenu for ContextMenu {
|
||||||
|
|
||||||
if ui.button("Download all").clicked() {
|
if ui.button("Download all").clicked() {
|
||||||
let Some(playlist) = gui.manifest.get_playlist(playlist_name) else {
|
let Some(playlist) = gui.manifest.get_playlist(playlist_name) else {
|
||||||
gui.throw_error(format!("Playlist not found: {}", playlist_name));
|
gui.throw_error(&format!("Playlist not found: {}", playlist_name));
|
||||||
ui.close_menu();
|
ui.close_menu();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
for (song_name, song) in playlist.get_songs() {
|
for (song_name, song) in playlist.get_songs() {
|
||||||
if let Err(e) = gui.downloader.download_song_nb(&gui.cfg, playlist_name, song_name, song, gui.manifest.get_format()) {
|
if let Err(e) = gui.downloader.download_song_nb(&gui.cfg, &playlist_name, song_name, song, gui.manifest.get_format()) {
|
||||||
gui.throw_error(format!("Could not download song: {e}"));
|
gui.throw_error(&format!("Could not download song: {e}"));
|
||||||
ui.close_menu();
|
ui.close_menu();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -41,11 +41,7 @@ impl ComponentContextMenu for ContextMenu {
|
||||||
}
|
}
|
||||||
if ui.button(RichText::new("Delete").color(Color32::RED)).clicked() {
|
if ui.button(RichText::new("Delete").color(Color32::RED)).clicked() {
|
||||||
let w = gui.windows.get_window::<windows::confirm::ConfirmW>(WindowIndex::Confirm);
|
let w = gui.windows.get_window::<windows::confirm::ConfirmW>(WindowIndex::Confirm);
|
||||||
w.set_message(
|
w.set_message(&"side_nav_playlist_manifest_delete", &"This will delete the playlist from the manifest file. This is NOT reversible", &vec![playlist_name.clone()]);
|
||||||
"side_nav_playlist_manifest_delete",
|
|
||||||
"This will delete the playlist from the manifest file. This is NOT reversible",
|
|
||||||
&[playlist_name.clone()]
|
|
||||||
);
|
|
||||||
gui.windows.open(WindowIndex::Confirm, true);
|
gui.windows.open(WindowIndex::Confirm, true);
|
||||||
ui.close_menu();
|
ui.close_menu();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,12 @@ impl ComponentUi for SideNav {
|
||||||
.context_menu(|ui| context_menu::ContextMenu::ui(gui, ui, &pname));
|
.context_menu(|ui| context_menu::ContextMenu::ui(gui, ui, &pname));
|
||||||
|
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
let text = if gui.current_playlist == *pname {
|
let text;
|
||||||
RichText::new(&pname).color(tint)
|
if gui.current_playlist == *pname {
|
||||||
|
text = RichText::new(&pname).color(tint);
|
||||||
} else {
|
} else {
|
||||||
RichText::new(&pname)
|
text = RichText::new(&pname);
|
||||||
};
|
}
|
||||||
|
|
||||||
let button = Label::new(text).sense(Sense::click()).selectable(false);
|
let button = Label::new(text).sense(Sense::click()).selectable(false);
|
||||||
let button = ui.add(button);
|
let button = ui.add(button);
|
||||||
|
|
|
@ -12,10 +12,10 @@ pub struct SongInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SongInfo {
|
impl SongInfo {
|
||||||
pub fn new(pname: &str, sname: &str, song: &Song) -> Self {
|
pub fn new(pname: &String, sname: &String, song: &Song) -> Self {
|
||||||
Self {
|
Self {
|
||||||
pname: pname.to_string(),
|
pname: pname.clone(),
|
||||||
sname: sname.to_string(),
|
sname: sname.clone(),
|
||||||
song: song.clone()
|
song: song.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,11 +83,7 @@ impl ComponentContextMenu for ContextMenu {
|
||||||
}
|
}
|
||||||
if ui.button(RichText::new("Delete").color(Color32::RED)).clicked() {
|
if ui.button(RichText::new("Delete").color(Color32::RED)).clicked() {
|
||||||
let w = gui.windows.get_window::<windows::confirm::ConfirmW>(WindowIndex::Confirm);
|
let w = gui.windows.get_window::<windows::confirm::ConfirmW>(WindowIndex::Confirm);
|
||||||
w.set_message(
|
w.set_message(&"song_list_song_manifest_delete", &"This will delete the song from the manifest file. This is NOT reversible", &vec![data.playlist_name().clone(), data.song_name().clone()]);
|
||||||
"song_list_song_manifest_delete",
|
|
||||||
"This will delete the song from the manifest file. This is NOT reversible",
|
|
||||||
&[data.playlist_name().clone(), data.song_name().clone()]
|
|
||||||
);
|
|
||||||
gui.windows.open(WindowIndex::Confirm, true);
|
gui.windows.open(WindowIndex::Confirm, true);
|
||||||
ui.close_menu();
|
ui.close_menu();
|
||||||
ui.close_menu();
|
ui.close_menu();
|
||||||
|
|
|
@ -53,7 +53,7 @@ impl Gui {
|
||||||
|
|
||||||
pub fn throw_error<S: ToString>(&mut self, text: S) {
|
pub fn throw_error<S: ToString>(&mut self, text: S) {
|
||||||
let w = self.windows.get_window::<windows::error::GuiError>(WindowIndex::Error);
|
let w = self.windows.get_window::<windows::error::GuiError>(WindowIndex::Error);
|
||||||
w.set_error_message(text);
|
w.set_error_message(&text);
|
||||||
self.windows.open(WindowIndex::Error, true);
|
self.windows.open(WindowIndex::Error, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use egui::{Color32, Label, RichText};
|
use egui::{Color32, Label, RichText, TextBuffer};
|
||||||
|
|
||||||
use super::{State, Window};
|
use super::{State, Window};
|
||||||
|
|
||||||
|
@ -41,10 +41,10 @@ impl Window for ConfirmW {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConfirmW {
|
impl ConfirmW {
|
||||||
pub fn set_message<S: ToString>(&mut self, new_id: S, text: S, data: &[String]) {
|
pub fn set_message<S: ToString>(&mut self, new_id: &S, text: &S, data: &Vec<String>) {
|
||||||
self.text = text.to_string();
|
self.text = text.to_string();
|
||||||
self.id = new_id.to_string();
|
self.id = new_id.to_string();
|
||||||
self.data = data.to_vec();
|
self.data = data.clone();
|
||||||
}
|
}
|
||||||
pub fn get_response(&self) -> (&String, &Option<bool>, &Vec<String>) {
|
pub fn get_response(&self) -> (&String, &Option<bool>, &Vec<String>) {
|
||||||
(&self.id, &self.response, &self.data)
|
(&self.id, &self.response, &self.data)
|
||||||
|
|
|
@ -27,7 +27,7 @@ impl Window for GuiError {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GuiError {
|
impl GuiError {
|
||||||
pub fn set_error_message<S: ToString>(&mut self, text: S) {
|
pub fn set_error_message<S: ToString>(&mut self, text: &S) {
|
||||||
self.text = text.to_string();
|
self.text = text.to_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::manifest::song::SongType;
|
use crate::manifest::song::{Song, SongType};
|
||||||
|
|
||||||
use super::{State, Window};
|
use super::{State, Window};
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ pub struct GuiImportPlaylist {
|
||||||
ed_type: SongType,
|
ed_type: SongType,
|
||||||
ed_name: String,
|
ed_name: String,
|
||||||
ed_url: String,
|
ed_url: String,
|
||||||
//urls_to_add: Vec<String>,
|
urls_to_add: Vec<String>,
|
||||||
// playlist_name: String,
|
playlist_name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ impl Window for GuiImportPlaylist {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//if let Some(_) = self.urls_to_add.pop() {
|
if let Some(url) = self.urls_to_add.pop() {
|
||||||
// todo!();
|
todo!();
|
||||||
//let client = reqwest::blocking::Client::new();
|
//let client = reqwest::blocking::Client::new();
|
||||||
// let song_name = crate::crawler::spotify::get_song_name(&client, url.clone())?;
|
// let song_name = crate::crawler::spotify::get_song_name(&client, url.clone())?;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ impl Window for GuiImportPlaylist {
|
||||||
// playlist.add_song(song_name, song);
|
// playlist.add_song(song_name, song);
|
||||||
//}
|
//}
|
||||||
//let _ = state.manifest.save(None);
|
//let _ = state.manifest.save(None);
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
|
||||||
if save {
|
if save {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user