changed main page layout and fixed some bugs

This commit is contained in:
ayabusa 2024-03-17 15:40:00 +01:00
parent 70169eaf67
commit 728b17288a
8 changed files with 85 additions and 42 deletions

2
src-tauri/Cargo.lock generated
View File

@ -3178,7 +3178,7 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
[[package]] [[package]]
name = "rusty-slicer" name = "rusty-slicer"
version = "0.0.1" version = "1.0.0"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"native-dialog", "native-dialog",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "rusty-slicer" name = "rusty-slicer"
version = "0.0.1" version = "1.0.0"
description = "An app to slice your playlist into multiple files" description = "An app to slice your playlist into multiple files"
authors = ["Ayabusa"] authors = ["Ayabusa"]
edition = "2021" edition = "2021"

View File

@ -75,13 +75,13 @@ async fn slice_button(app: tauri::AppHandle, chapter: String, fileformat: String
};*/ };*/
// create the progress window // create the progress window
let _about_window = tauri::WindowBuilder::new( let _progress_window = tauri::WindowBuilder::new(
&app, &app,
"progress", /* the unique window label */ "progress", /* the unique window label */
tauri::WindowUrl::App("progress.html".into()) tauri::WindowUrl::App("progress.html".into())
).build().expect("failed to create progress window"); ).build().expect("failed to create progress window");
_about_window.set_title("Slicing progress").unwrap(); _progress_window.set_title("Slicing progress").unwrap();
_about_window.set_size(Size::Physical(PhysicalSize { width: 400, height: 100 })).unwrap(); _progress_window.set_size(Size::Physical(PhysicalSize { width: 400, height: 100 })).unwrap();
for i in 0..time_codes.len(){ for i in 0..time_codes.len(){
let args: Vec<String>; let args: Vec<String>;
@ -91,7 +91,9 @@ async fn slice_button(app: tauri::AppHandle, chapter: String, fileformat: String
output_file.set_extension(&fileformat); output_file.set_extension(&fileformat);
if i+1<time_codes.len() { if i+1<time_codes.len() {
args = vec!["-i".to_owned(), args = vec![
"-y".to_owned(), // overwrite existing files
"-i".to_owned(),
FILE_PATH.lock().unwrap().to_owned(), FILE_PATH.lock().unwrap().to_owned(),
"-ss".to_owned(), "-ss".to_owned(),
time_codes[i].to_owned(), time_codes[i].to_owned(),
@ -101,7 +103,9 @@ async fn slice_button(app: tauri::AppHandle, chapter: String, fileformat: String
//format!("{:?}", output_file), //format!("{:?}", output_file),
output_file.display().to_string()]; output_file.display().to_string()];
}else { // case for the last song }else { // case for the last song
args = vec!["-i".to_owned(), args = vec![
"-y".to_owned(), // overwrite existing files
"-i".to_owned(),
FILE_PATH.lock().unwrap().to_owned(), FILE_PATH.lock().unwrap().to_owned(),
"-ss".to_owned(), "-ss".to_owned(),
time_codes[i].to_owned(), time_codes[i].to_owned(),
@ -116,6 +120,15 @@ async fn slice_button(app: tauri::AppHandle, chapter: String, fileformat: String
// update progress bar on frontend // update progress bar on frontend
app.emit_all("progress_state_changed", Payload { message: format!("{}", (i+1)*100/time_codes.len()) }).unwrap(); app.emit_all("progress_state_changed", Payload { message: format!("{}", (i+1)*100/time_codes.len()) }).unwrap();
} }
_progress_window.close().unwrap(); // close the progress window, before creating the done one
let _done_window = tauri::WindowBuilder::new(
&app,
"done", /* the unique window label */
tauri::WindowUrl::App("done.html".into())
).build().expect("failed to create done window");
_done_window.set_title("Rusty Slicer").unwrap();
_done_window.set_size(Size::Physical(PhysicalSize { width: 400, height: 100 })).unwrap();
} }
#[tauri::command] #[tauri::command]

View File

@ -6,7 +6,7 @@
}, },
"package": { "package": {
"productName": "rusty-slicer", "productName": "rusty-slicer",
"version": "0.0.1" "version": "1.0.0"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {
@ -24,8 +24,8 @@
"fullscreen": false, "fullscreen": false,
"resizable": true, "resizable": true,
"title": "Rusty slicer", "title": "Rusty slicer",
"width": 450, "width": 830,
"height": 950 "height": 700
} }
], ],
"security": { "security": {

View File

@ -9,7 +9,7 @@
<body> <body>
<div class="about_main"> <div class="about_main">
<h1> Rusty Slicer V0.0.1 </h1> <h1> Rusty Slicer V1.0.0 </h1>
<h2 class="credit"> Credit </h2> <h2 class="credit"> Credit </h2>
<p class="credit"> <p class="credit">
<b> <b>

12
src/done.html Normal file
View File

@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="styles.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Rusty Slicer</title>
</head>
<body>
<p class="credit" id="progress_label"> Finished slicing :D </p>
</body>

View File

@ -16,47 +16,52 @@
<div class="main-container"> <div class="main-container">
<div> <div>
<h3>Welcome to the Rusty slicer! <img src="assets/cat-vibe-vibe-cat.gif"></h1> <h3>Welcome to the Rusty slicer! <img src="assets/cat-vibe-vibe-cat.gif"></h1>
<div class="select-file">
<div>
<h4><b> Input file </b></h4>
<p id="fileLocation"> no location choosen </p>
</div>
<button id="fileButton">choose file 📂</button>
</div>
<div> <div class="action-container">
<h4><b> Chapter list (timecode - song name) </b></h4> <div>
<textarea id="chapterList" rows="30" cols="10000" placeholder="0:00 - my first song <h4><b> Chapter list (timecode - song name) </b></h4>
<textarea id="chapterList" rows="30" cols="10000" placeholder="0:00 - my first song
3:30 - another one 3:30 - another one
13:37 - one more time - Daft punk"></textarea> 13:37 - one more time - Daft punk"></textarea>
<p id="errorLabel" style="color: red;"></p> <p id="errorLabel" style="color: red;"></p>
</div>
<div class="select-file">
<div>
<p><b> Output folder </b> </p>
<p id="folderLocation"> no location choosen </p>
</div> </div>
<button id="folderButton">choose folder 📂</button>
</div>
<div class="select-file"> <div>
<p><b> output type </b></p> <div class="select-file">
<select id="fileFormatSelect"> <div>
<option value="mp3">mp3 (recommended)</option> <h4><b> Input file </b></h4>
<option value="ogg">ogg</option> <p id="fileLocation"> no location choosen </p>
<option value="flac">flac (really long)</option> </div>
<option value="m4a">m4a</option> <button id="fileButton">choose file 📂</button>
</select> </div>
</div>
<button class="slice-button" id="sliceButton"> Slice 🔪</button> <div class="select-file">
<div>
<p><b> Output folder </b> </p>
<p id="folderLocation"> no location choosen </p>
</div>
<button id="folderButton">choose folder 📂</button>
</div>
<div class="select-file">
<p><b> output type </b></p>
<select id="fileFormatSelect">
<option value="mp3">mp3 (recommended)</option>
<option value="ogg">ogg</option>
<option value="flac">flac (really long)</option>
<option value="m4a">m4a</option>
</select>
</div>
<br> <br>
<button class="slice-button" id="sliceButton"> Slice 🔪</button>
</div>
</div>
</div> </div>
<footer> <footer>
<br> <br>
<div class="select-file"> <div class="select-file">
<div> <div class="credit_main">
made by <a target="_blank" href="https://www.ayabusa.dev"> made by <a target="_blank" href="https://www.ayabusa.dev">
ayabusa ayabusa
</a> ;D </a> ;D

View File

@ -17,7 +17,8 @@
} }
textarea { textarea {
width: 100%; width: 95%;
flex: 1;
} }
img{ img{
@ -42,6 +43,13 @@ img{
height: 97vh; height: 97vh;
} }
.action-container{
display: grid;
grid-auto-flow: column;
grid-auto-columns: 1fr;
}
::-moz-selection { /* Code for Firefox */ ::-moz-selection { /* Code for Firefox */
color: #ffffff; color: #ffffff;
background: #d88939; background: #d88939;
@ -56,6 +64,10 @@ a {
color: #d88939; color: #d88939;
} }
.credit_main {
margin-left: auto;
margin-right: auto;
}
.credit { .credit {
text-align: center; text-align: center;
} }
@ -107,6 +119,7 @@ button {
border-color: #292829; border-color: #292829;
color: #292829; color: #292829;
background-color: #d88939; background-color: #d88939;
float: right;
} }
.slice-button:hover{ .slice-button:hover{