Skip to content

Commit 7f996e6

Browse files
Etienne CoppinEtienne Coppin
authored andcommitted
Updated version for mac, added bin for mac
1 parent 1601a9f commit 7f996e6

7 files changed

Lines changed: 66 additions & 37 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.exe filter=lfs diff=lfs merge=lfs -text
22
out/make/squirrel.windows/x64/HypLoad-1.0.0[[:space:]]Setup.exe filter=lfs diff=lfs merge=lfs -text
3+
out/make/HypLoad-1.0.0-arm64.dmg filter=lfs diff=lfs merge=lfs -text

data/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"color_mode": "dark",
2+
"color_mode": "light",
33
"only_audio": true,
44
"video_res": "bv",
55
"audio_format": "mp3",
6-
"lang": "fr"
6+
"lang": "en"
77
}

forge.config.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ module.exports = {
2929
},
3030
rebuildConfig: {},
3131
makers: [
32-
{
33-
name: '@electron-forge/maker-squirrel',
34-
platforms: ['win32'],
35-
config: {
36-
loadingGif: "./assets/loading.gif",
37-
appDirectory: "./",
38-
exe: "HypLoad.exe",
39-
iconUrl: 'https://github.com/Hypocrate-code/HypLoad/blob/main/assets/icon.ico?raw=true',
40-
setupIcon: './assets/icon.ico',
41-
noMsi: false
42-
},
43-
},
32+
// {
33+
// name: '@electron-forge/maker-squirrel',
34+
// platforms: ['win32'],
35+
// config: {
36+
// loadingGif: "./assets/loading.gif",
37+
// appDirectory: "./",
38+
// exe: "HypLoad.exe",
39+
// iconUrl: 'https://github.com/Hypocrate-code/HypLoad/blob/main/assets/icon.ico?raw=true',
40+
// setupIcon: './assets/icon.ico',
41+
// noMsi: false
42+
// },
43+
// },
4444
// {
4545
// name: '@electron-forge/maker-zip',
4646
// platforms: ['darwin'],
@@ -53,15 +53,15 @@ module.exports = {
5353
// }
5454
// },
5555
// },
56-
// {
57-
// name: '@electron-forge/maker-dmg',
58-
// platforms: ['darwin'],
59-
// config: {
60-
// // background: './assets/icon.png',
61-
// icon: "./assets/icon.icns",
62-
// format: 'ULFO'
63-
// }
64-
// },
56+
{
57+
name: '@electron-forge/maker-dmg',
58+
platforms: ['darwin'],
59+
config: {
60+
// background: './assets/icon.png',
61+
icon: "./assets/icon.icns",
62+
format: 'ULFO'
63+
}
64+
},
6565
// {
6666
// name: '@electron-forge/maker-rpm',
6767
// config: {},

js/main/loadPlaylist.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ async function loadPlaylist(e, link) {
5959
sharedState.currentProcess = cmd.pid;
6060

6161
cmd.stdout.on('data', (data) => {
62-
const baseString = iconv.decode(data, 'windows1252').replaceAll(" | \n", " | ");
62+
const baseString = data.toString().replaceAll(" | \n", " | ");
6363
const newData = baseString.split(' | ');
6464
newData.pop();
65-
console.log("new d : ", newData);
6665
const chuckOfData = chunkArray(newData, size=9)
6766
chuckOfData.forEach(el => {
6867
console.log("un el : ", el);

js/main/savedPlaylists.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ const path = require('node:path');
2222
const fs = require("fs");
2323

2424
const PLAYLISTS_FILE_PATH = path.join(app.getPath('userData'), "playlists.json");
25+
console.log(PLAYLISTS_FILE_PATH);
2526
const PLAYLISTS_DEFAULT_FILE_PATH = path.join(__dirname, "..", "..", "playlists-default.json");
27+
console.log(PLAYLISTS_DEFAULT_FILE_PATH);
2628

2729
async function setNewLink(e, link, title) {
2830
const data = await getJSONFile(PLAYLISTS_FILE_PATH);
2931
data[link] = title;
3032
saveJSONFile(PLAYLISTS_FILE_PATH, data);
3133
}
3234

33-
console.log(app.getPath('userData'));
34-
3535

3636
async function getPlaylistLinks() {
3737
try {

js/main/utils_file.js

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
const path = require('node:path');
2121
const fs = require("fs");
2222
const { app } = require("electron");
23+
const { platform } = require('node:os');
2324

2425
const OPTIONS_FILE_PATH = path.join(app.getPath('userData'), "config.json");
2526
const OPTIONS_DEFAULT_FILE_PATH = path.join(__dirname, "..", "..", "config-default.json");
@@ -72,7 +73,12 @@ function setOptions (options) {
7273
}
7374

7475
async function isAlreadyDownloaded(e, title, onlyAudio, format, playlistName) {
76+
if (platform() === "darwin") {title = sanitizeFilename(title)}
7577
const isPath = path.join(onlyAudio ? app.getPath('music') : app.getPath('videos'),'HypLoad', sanitizeFolderName(playlistName),`${title}.${format}`);;
78+
console.log(isPath);
79+
80+
console.log(fs.readdirSync( path.join(app.getPath('music'), "HypLoad", sanitizeFolderName(playlistName) ) ));
81+
7682
return new Promise((resolve) => {
7783
fs.access(isPath, fs.constants.F_OK, (err) => {
7884
if (err) {
@@ -89,19 +95,39 @@ async function isAlreadyDownloaded(e, title, onlyAudio, format, playlistName) {
8995

9096
function sanitizeFolderName(name) {
9197
console.log('name', name);
92-
const forbidden = /[<>:"/\\|?*\x00-\x1F]/g;
93-
const reserved = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i;
94-
let cleaned = name.replace(forbidden, "_").trim();
95-
cleaned = cleaned.replace(/[ .]+$/g, "");
96-
if (reserved.test(cleaned)) {
97-
cleaned += "_playlist";
98-
}
99-
if (!cleaned.length) {
100-
cleaned = "playlist";
98+
if (platform() === "darwin") {return sanitizeFilename(name)}
99+
else {
100+
const forbidden = /[<>:"/\\|?*\x00-\x1F]/g;
101+
const reserved = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i;
102+
let cleaned = name.replace(forbidden, "_").trim();
103+
cleaned = cleaned.replace(/[ .]+$/g, "");
104+
if (reserved.test(cleaned)) {
105+
cleaned += "_playlist";
106+
}
107+
if (!cleaned.length) {
108+
cleaned = "";
109+
}
110+
return cleaned;
101111
}
102-
return cleaned;
103112
}
104113

114+
function sanitizeFilename(str) {
115+
const map = {
116+
'/': '/',
117+
'\\': '\',
118+
':': ':',
119+
'*': '*',
120+
'?': '?',
121+
'"': '"',
122+
'<': '<',
123+
'>': '>',
124+
'|': '|'
125+
};
126+
127+
return str.replace(/[\/\\:\*\?"<>|]/g, m => map[m]);
128+
}
129+
130+
105131

106132

107133
module.exports = { getOptions, setOptions, isAlreadyDownloaded, getJSONFile, saveJSONFile, sanitizeFolderName };

out/make/HypLoad-1.0.0-arm64.dmg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:3be16238344095d52703f4dfcf419ffe8ddeb98a0eaf1094500757a11a116349
3+
size 168426359

0 commit comments

Comments
 (0)