mirror of https://git.fuwafuwa.moe/SMLoadrDev/SMLoadr synced 2024-11-10 21:44:31 +01:00

Release v1.9.5

This commit is contained in:
FatKiwi 2019-03-11 17:24:08 +00:00
parent 39751aed19
commit 07b703ea03
7 changed files with 3950 additions and 124 deletions

3
BUILD.cmd Normal file
View File

@ -0,0 +1,3 @@
rmdir /s /q BUILD
node_modules/.bin/pkg package.json --targets latest-macos-x64,latest-win-x86,latest-win-x64,latest-linux-x86,latest-linux-x64 --out-dir BUILD

67
BUILD.sh Normal file
View File

@ -0,0 +1,67 @@
#!/bin/bash
# Build script
silent() { "$@" >/dev/null 2>&1; }
# Usage
usage="usage: $0 [options] [targets]
target - Any valid pkg target(s) (default is macos-x64,win{-x86,-x64},linux{-x86,-x64})
Can be either space- or comma- seperated ('macos-x64 win-x86,linux' is valid)
-n --no-update - Don't install/update node modules
-h --help - Show this help"
# Arg parsing
for arg in "$@"; do
case "$arg" in
-h|--help)
echo "$usage"
exit 1
;;
-n|--no-update)
NO_UPDATE_NM=true
;;
*)
if [[ -z "$targets" ]]; then
targets="$arg"
else
targets+=",$arg"
fi
;;
esac
done
# Update node modules
if [[ -z "$NO_UPDATE_NM" ]] && ! silent type npm; then
echo "ERROR: npm not found."
exit 1
fi
if [[ -z "$NO_UPDATE_NM" ]]; then
npm install
fi
# Ensure needed files are available
if [[ -e "./node_modules/.bin/pkg" ]]; then
PKG_CMD="./node_modules/.bin/pkg"
elif silent type pkg; then
PKG_CMD="pkg"
else
echo "ERROR: script couldn't find pkg!"
exit 1
fi
if ! [[ -e package.json ]]; then
echo -e "Wow. You are incredible.\nYou managed end up missing package.json in the current directory.\nGo home, you're drunk."
exit 1
fi
# If targets list is empty, use defaults
if [[ -z "$targets" ]]; then
targets="latest-macos-x64,latest-win-x64,latest-win-x86,latest-linux-x64,latest-linux-x86"
fi
# Package away
exec "$PKG_CMD" --out-dir "BUILD/" -t "$targets" package.json

2885
SMLoadr.js

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
1.9.4 1.9.5

1048
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
{ {
"name": "SMLoadr", "name": "SMLoadr",
"version": "1.9.4", "version": "1.9.5",
"description": "A streaming music downloader written in NodeJS.", "description": "A streaming music downloader written in NodeJS.",
"author": "SMLoadrDev", "author": "SMLoadrDev",
"license": "Unlicense", "license": "Unlicense",
"private": true, "private": false,
"main": "SMLoadr.js", "main": "SMLoadr.js",
"bin": "SMLoadr.js", "bin": "SMLoadr.js",
"repository": { "repository": {
@ -15,20 +15,23 @@
"node": ">=8.0.0" "node": ">=8.0.0"
}, },
"dependencies": { "dependencies": {
"bluebird": "^3.5.1", "bluebird": "^3.5.3",
"cache-manager": "^2.9.0", "cache-manager": "^2.9.0",
"chalk": "^2.4.1", "chalk": "^2.4.2",
"command-line-args": "^5.0.2", "command-line-args": "^5.0.2",
"command-line-usage": "^5.0.5", "command-line-usage": "^5.0.5",
"fs-finder": "^1.8.1", "fs-finder": "^1.8.1",
"inquirer": "^6.0.0", "inquirer": "^6.2.2",
"jsonfile": "^4.0.0", "jsonfile": "^5.0.0",
"log": "^1.4.0", "log": "^1.4.0",
"openurl": "^1.1.1", "openurl": "^1.1.1",
"ora": "^3.0.0", "ora": "^3.2.0",
"request": "^2.85.0", "request": "^2.88.0",
"request-plus": "^1.0.1", "request-plus": "^2.0.0",
"sanitize-filename": "^1.6.1", "sanitize-filename": "^1.6.1",
"util": "^0.11.0" "util": "^0.11.1"
},
"devDependencies": {
"pkg": "4.3.1"
} }
} }

View File

@ -0,0 +1,46 @@
const nodeJsonFile = require('jsonfile');
module.exports = class ConfigService {
constructor(configFile) {
this.configFile = configFile;
this.config = {
saveLayout: "",
arl: ""
};
this.loadConfig();
}
loadConfig() {
let configFileContent = this.config;
try {
configFileContent = nodeJsonFile.readFileSync(this.configFile);
} catch (e) {
return this.config;
}
Object.entries(configFileContent).forEach(([key, value]) => {
this.config[key] = value;
});
return this.config;
}
saveConfig() {
nodeJsonFile.writeFileSync(this.configFile, this.config, {spaces: 4, EOL: '\r\n'});
}
set(key, value) {
this.config[key] = value
}
get(key) {
if (typeof key === 'undefined') {
return this.config;
}
return this.config[key];
}
};