configure upload attachment size. remove bitrate compression.
This commit is contained in:
parent
d59c50e7a9
commit
c364343fe9
@ -5,7 +5,7 @@ use tokio::fs::File;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
cmds::autocomplete_sound,
|
cmds::autocomplete_sound,
|
||||||
consts::{MAX_SOUNDS, PATREON_GUILD, PATREON_ROLE},
|
consts::{MAX_SOUNDS, PATREON_GUILD, PATREON_ROLE, UPLOAD_MAX_SIZE},
|
||||||
models::sound::{Sound, SoundCtx},
|
models::sound::{Sound, SoundCtx},
|
||||||
Context, Error,
|
Context, Error,
|
||||||
};
|
};
|
||||||
@ -59,7 +59,7 @@ pub async fn upload_new_sound(
|
|||||||
|
|
||||||
if permit_upload {
|
if permit_upload {
|
||||||
let attachment = {
|
let attachment = {
|
||||||
ctx.say("Please now upload an audio file under 1MB in size (larger files will be automatically trimmed):").await?;
|
ctx.say(format!("Please now upload an audio file under {}MB in size (larger files will be automatically trimmed):", *UPLOAD_MAX_SIZE / (1024u64.pow(2)))).await?;
|
||||||
|
|
||||||
let reply = ctx
|
let reply = ctx
|
||||||
.channel_id()
|
.channel_id()
|
||||||
|
@ -3,6 +3,10 @@ use std::env;
|
|||||||
pub const THEME_COLOR: u32 = 0x00e0f3;
|
pub const THEME_COLOR: u32 = 0x00e0f3;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
pub static ref UPLOAD_MAX_SIZE: u64 = env::var("UPLOAD_MAX_SIZE")
|
||||||
|
.unwrap_or_else(|_| "2097152".to_string())
|
||||||
|
.parse::<u64>()
|
||||||
|
.unwrap();
|
||||||
pub static ref MAX_SOUNDS: u32 = env::var("MAX_SOUNDS").unwrap().parse::<u32>().unwrap();
|
pub static ref MAX_SOUNDS: u32 = env::var("MAX_SOUNDS").unwrap().parse::<u32>().unwrap();
|
||||||
pub static ref PATREON_GUILD: u64 = env::var("PATREON_GUILD").unwrap().parse::<u64>().unwrap();
|
pub static ref PATREON_GUILD: u64 = env::var("PATREON_GUILD").unwrap().parse::<u64>().unwrap();
|
||||||
pub static ref PATREON_ROLE: u64 = env::var("PATREON_ROLE").unwrap().parse::<u64>().unwrap();
|
pub static ref PATREON_ROLE: u64 = env::var("PATREON_ROLE").unwrap().parse::<u64>().unwrap();
|
||||||
|
@ -5,7 +5,7 @@ use songbird::input::restartable::Restartable;
|
|||||||
use sqlx::{mysql::MySqlPool, Error};
|
use sqlx::{mysql::MySqlPool, Error};
|
||||||
use tokio::{fs::File, io::AsyncWriteExt, process::Command};
|
use tokio::{fs::File, io::AsyncWriteExt, process::Command};
|
||||||
|
|
||||||
use crate::{error::ErrorTypes, Data};
|
use crate::{consts::UPLOAD_MAX_SIZE, error::ErrorTypes, Data};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Sound {
|
pub struct Sound {
|
||||||
@ -361,12 +361,10 @@ DELETE
|
|||||||
.arg(src_url)
|
.arg(src_url)
|
||||||
.arg("-loglevel")
|
.arg("-loglevel")
|
||||||
.arg("error")
|
.arg("error")
|
||||||
.arg("-b:a")
|
|
||||||
.arg("28000")
|
|
||||||
.arg("-f")
|
.arg("-f")
|
||||||
.arg("opus")
|
.arg("opus")
|
||||||
.arg("-fs")
|
.arg("-fs")
|
||||||
.arg("1048576")
|
.arg(UPLOAD_MAX_SIZE.to_string())
|
||||||
.arg("pipe:1")
|
.arg("pipe:1")
|
||||||
.output()
|
.output()
|
||||||
.await;
|
.await;
|
||||||
|
Loading…
Reference in New Issue
Block a user