add nitro flag
This commit is contained in:
parent
df63747376
commit
61defcc7b0
2 changed files with 20 additions and 4 deletions
|
@ -12,6 +12,7 @@ Head to [the release page](https://git.mylloon.fr/Anri/dsr/releases/latest).
|
||||||
- [x] Support drag&drop
|
- [x] Support drag&drop
|
||||||
- [x] Keep the video under 25mb (discord limitation)
|
- [x] Keep the video under 25mb (discord limitation)
|
||||||
- [x] If already under the limit, the file won't be compressed
|
- [x] If already under the limit, the file won't be compressed
|
||||||
|
- [x] Nitro suppport via `/nitro` flag
|
||||||
- [x] Merge all audio files into one track, while keeping the original ones (keeping track's title too)
|
- [x] Merge all audio files into one track, while keeping the original ones (keeping track's title too)
|
||||||
- [x] Support multiples files
|
- [x] Support multiples files
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,12 @@ let internals: {
|
||||||
/** Search for files */
|
/** Search for files */
|
||||||
const getFiles = async () => {
|
const getFiles = async () => {
|
||||||
const allowedExtensions = (await internals.allowedExtensions()).extensions;
|
const allowedExtensions = (await internals.allowedExtensions()).extensions;
|
||||||
const argv = await internals.argv();
|
const argvFiles = (await internals.argv())
|
||||||
if (argv.length >= 2) {
|
.slice(1)
|
||||||
const files = argv.slice(1);
|
.filter((element) => !element.startsWith("/"));
|
||||||
|
|
||||||
|
if (argvFiles.length > 0) {
|
||||||
|
const files = argvFiles;
|
||||||
|
|
||||||
// Exit if a file isn't supported in the list
|
// Exit if a file isn't supported in the list
|
||||||
if (
|
if (
|
||||||
|
@ -40,6 +43,18 @@ const getFiles = async () => {
|
||||||
return files;
|
return files;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Returns maximum allowed size for files in MB */
|
||||||
|
const fetchMaxSize = async () => {
|
||||||
|
const argv = await internals.argv();
|
||||||
|
if (argv.includes("/nitro")) {
|
||||||
|
// Nitro user
|
||||||
|
return 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free user
|
||||||
|
return 25;
|
||||||
|
};
|
||||||
|
|
||||||
/** Either replace the message, or add some info */
|
/** Either replace the message, or add some info */
|
||||||
enum Mode {
|
enum Mode {
|
||||||
Write,
|
Write,
|
||||||
|
@ -71,7 +86,7 @@ const updateMessage = (
|
||||||
|
|
||||||
/** Main function */
|
/** Main function */
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
const maxSizeDiscord = 25;
|
const maxSizeDiscord = await fetchMaxSize();
|
||||||
updateMessage("Récupération des fichiers...");
|
updateMessage("Récupération des fichiers...");
|
||||||
const files = await getFiles();
|
const files = await getFiles();
|
||||||
let processedFiles = "";
|
let processedFiles = "";
|
||||||
|
|
Loading…
Reference in a new issue