mirror of
https://github.com/codeforreal1/compressO
synced 2026-04-21 15:47:56 +00:00
Resume work
This commit is contained in:
parent
b4ebc2980e
commit
45fca7b2c6
12 changed files with 87 additions and 65 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -37,3 +37,4 @@ yarn-error.log*
|
|||
next-env.d.ts
|
||||
|
||||
|
||||
/**/.env
|
||||
|
|
@ -1,35 +1,35 @@
|
|||
/** @type {import('next').NextConfig} */
|
||||
|
||||
import million from 'million/compiler'
|
||||
import analyzeBundle from '@next/bundle-analyzer'
|
||||
import million from "million/compiler";
|
||||
import analyzeBundle from "@next/bundle-analyzer";
|
||||
|
||||
const withBundleAnalyzer = analyzeBundle({
|
||||
enabled: process.env.ANALYZE === 'true',
|
||||
})
|
||||
enabled: process.env.ANALYZE === "true",
|
||||
});
|
||||
|
||||
const nextConfig = withBundleAnalyzer({
|
||||
output: 'export',
|
||||
distDir: "./dist",
|
||||
webpack(config, {webpack}) {
|
||||
config.module.rules.push({
|
||||
test: /\.svg$/,
|
||||
use: ['@svgr/webpack'],
|
||||
output: "export",
|
||||
distDir: "./dist",
|
||||
webpack(config, { webpack }) {
|
||||
config.module.rules.push({
|
||||
test: /\.svg$/,
|
||||
use: ["@svgr/webpack"],
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
config.plugins.push(
|
||||
new webpack.DefinePlugin({
|
||||
"globalThis.__DEV__": false,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
config.plugins.push(
|
||||
new webpack.DefinePlugin({
|
||||
'globalThis.__DEV__': false,
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
return config
|
||||
},
|
||||
})
|
||||
return config;
|
||||
},
|
||||
});
|
||||
|
||||
const millionConfig = {
|
||||
auto: true,
|
||||
}
|
||||
auto: true,
|
||||
};
|
||||
|
||||
export default million.next(nextConfig, millionConfig)
|
||||
export default million.next(nextConfig, millionConfig);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"pnpm:devPreinstall": "fnm use",
|
||||
"next:dev": "next dev",
|
||||
"next:build": "next build",
|
||||
"next:start": "next start",
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ rust-version = "1.60"
|
|||
|
||||
|
||||
[lib]
|
||||
name = "libs"
|
||||
path = "src/libs/mod.rs"
|
||||
name = "lib"
|
||||
path = "src/lib/mod.rs"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1.5.0", features = [] }
|
||||
|
|
@ -20,7 +20,12 @@ tauri-build = { version = "1.5.0", features = [] }
|
|||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.5.2", features = [ "dialog-save", "dialog-open", "shell-sidecar", "process-command-api"] }
|
||||
tauri = { version = "1.5.2", features = [
|
||||
"dialog-save",
|
||||
"dialog-open",
|
||||
"shell-sidecar",
|
||||
"process-command-api",
|
||||
] }
|
||||
tokio = { version = "1.34.0", features = ["rt", "rt-multi-thread", "macros"] }
|
||||
|
||||
[features]
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -14,8 +14,24 @@ pub async fn compress(video_path: &str) -> Result<String, String> {
|
|||
}
|
||||
};
|
||||
|
||||
let output_file: PathBuf = [output_dir, PathBuf::from("didThisWork.mp4")].iter().collect();
|
||||
let (mut rx, _) = match ffmpeg.args(["-i", video_path, "-vcodec", "libx264", "-crf", " 28", "-vf", "pad=ceil(iw/2)*2:ceil(ih/2)*2", &output_file.display().to_string(), "-y"]).spawn() {
|
||||
let output_file: PathBuf = [output_dir, PathBuf::from("didThisWork.mp4")]
|
||||
.iter()
|
||||
.collect();
|
||||
let (mut rx, _) = match ffmpeg
|
||||
.args([
|
||||
"-i",
|
||||
video_path,
|
||||
"-vcodec",
|
||||
"libx264",
|
||||
"-crf",
|
||||
" 28",
|
||||
"-vf",
|
||||
"pad=ceil(iw/2)*2:ceil(ih/2)*2",
|
||||
&output_file.display().to_string(),
|
||||
"-y",
|
||||
])
|
||||
.spawn()
|
||||
{
|
||||
Ok(ok) => ok,
|
||||
Err(err) => {
|
||||
return Err(err.to_string());
|
||||
|
|
@ -30,9 +46,11 @@ pub async fn compress(video_path: &str) -> Result<String, String> {
|
|||
// // println!("----{}----", line);
|
||||
// }
|
||||
}
|
||||
}).await {
|
||||
})
|
||||
.await
|
||||
{
|
||||
return Err(err.to_string());
|
||||
}
|
||||
|
||||
Ok(String::from("Complete"))
|
||||
}
|
||||
}
|
||||
|
|
@ -4,8 +4,8 @@ use std::path::PathBuf;
|
|||
use tauri::api::path::cache_dir;
|
||||
|
||||
/**
|
||||
Create cache directory if not exists.
|
||||
*/
|
||||
Create .cache directory if not exists.
|
||||
*/
|
||||
|
||||
// TODO: Do not allow compressing the same file that is in the cache directory
|
||||
pub fn create_cache_dir() -> Result<PathBuf, String> {
|
||||
|
|
@ -15,7 +15,7 @@ pub fn create_cache_dir() -> Result<PathBuf, String> {
|
|||
return Err(String::from("No cache directory found"));
|
||||
}
|
||||
};
|
||||
let full_path: PathBuf = [cache_dir, PathBuf::from("Compressorx")].iter().collect();
|
||||
let full_path: PathBuf = [cache_dir, PathBuf::from("CompressO")].iter().collect();
|
||||
if !full_path.is_dir() {
|
||||
if let Err(err) = fs::create_dir(&full_path) {
|
||||
return Err(err.to_string());
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
|
||||
use libs::ffmpeg;
|
||||
use lib::ffmpeg;
|
||||
|
||||
#[tauri::command]
|
||||
async fn compress(path: &str) -> Result<String, String> {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
"distDir": "../dist"
|
||||
},
|
||||
"package": {
|
||||
"productName": "CompressorX",
|
||||
"version": "0.1.0"
|
||||
"productName": "CompressO",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
|
|
@ -34,9 +34,7 @@
|
|||
"deb": {
|
||||
"depends": []
|
||||
},
|
||||
"externalBin": [
|
||||
"./bin/ffmpeg"
|
||||
],
|
||||
"externalBin": ["./bin/ffmpeg"],
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
|
|
|
|||
|
|
@ -1,48 +1,48 @@
|
|||
import type { Config } from 'tailwindcss'
|
||||
import { nextui } from '@nextui-org/theme'
|
||||
import type { Config } from "tailwindcss";
|
||||
import { nextui } from "@nextui-org/theme";
|
||||
|
||||
const WIDTHS = Object.freeze({
|
||||
xs: '320px',
|
||||
sm: '576px',
|
||||
md: '768px',
|
||||
lg: '992px',
|
||||
xl: '1280px',
|
||||
'2xl': '1440px',
|
||||
'3xl': '1660px',
|
||||
})
|
||||
xs: "320px",
|
||||
sm: "576px",
|
||||
md: "768px",
|
||||
lg: "992px",
|
||||
xl: "1280px",
|
||||
"2xl": "1440px",
|
||||
"3xl": "1660px",
|
||||
});
|
||||
|
||||
const config: Config = {
|
||||
darkMode: 'class',
|
||||
darkMode: "class",
|
||||
plugins: [
|
||||
nextui({
|
||||
addCommonColors: true,
|
||||
}),
|
||||
],
|
||||
content: [
|
||||
'./src/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
"./src/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
// NextUI Components
|
||||
'./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}',
|
||||
"./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}",
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
backgroundImage: {
|
||||
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
|
||||
'gradient-conic':
|
||||
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
|
||||
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
|
||||
"gradient-conic":
|
||||
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
|
||||
},
|
||||
colors: {
|
||||
primary: '#7f46e2',
|
||||
secondary: '#ff6ae7',
|
||||
black1: '#000000',
|
||||
gray1: '#c2c2c2',
|
||||
white1: '#ffffff',
|
||||
primary: "#7f46e2",
|
||||
secondary: "#ff6ae7",
|
||||
black1: "#000000",
|
||||
gray1: "#c2c2c2",
|
||||
white1: "#ffffff",
|
||||
},
|
||||
fontFamily: {
|
||||
Poppins: ['var(--font-Poppins)'],
|
||||
Poppins: ["var(--font-Poppins)"],
|
||||
},
|
||||
screens: WIDTHS,
|
||||
maxWidth: WIDTHS,
|
||||
},
|
||||
},
|
||||
}
|
||||
export default config
|
||||
};
|
||||
export default config;
|
||||
|
|
|
|||
Loading…
Reference in a new issue