Skip to content

Commit aa577d8

Browse files
authored
Merge pull request #230 from entrylabs/develop
version up : 2.1.30
2 parents dadc871 + 8c76f8a commit aa577d8

File tree

571 files changed

+103909
-81332
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

571 files changed

+103909
-81332
lines changed

build/entryx64.nsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
!define MUI_UNICON "icon.ico"
1414
!define PRODUCT_NAME "Entry"
1515
!define APP_NAME "Entry.exe"
16-
!define PRODUCT_VERSION "2.1.29"
16+
!define PRODUCT_VERSION "2.1.30"
1717
!define PRODUCT_PUBLISHER "EntryLabs"
1818
!define PRODUCT_WEB_SITE "http://www.playentry.org/"
1919

build/entryx86.nsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
!define MUI_UNICON "icon.ico"
1414
!define PRODUCT_NAME "Entry"
1515
!define APP_NAME "Entry.exe"
16-
!define PRODUCT_VERSION "2.1.29"
16+
!define PRODUCT_VERSION "2.1.30"
1717
!define PRODUCT_PUBLISHER "EntryLabs"
1818
!define PRODUCT_WEB_SITE "http://www.playentry.org/"
1919

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"productName": "Entry",
44
"name": "entry",
5-
"version": "2.1.29",
5+
"version": "2.1.30",
66
"description": "Entry for offline",
77
"main": "src/main_build/main.bundle.js",
88
"scripts": {
@@ -39,8 +39,8 @@
3939
"async-csv": "^2.1.3",
4040
"axios": "^0.19.2",
4141
"cross-spawn": "^7.0.3",
42-
"entry-hw": "git+https://github.com/entrylabs/entry-hw.git#dist/v1.9.68",
43-
"entry-js": "git+https://github.com/entrylabs/entryjs.git#dist/offline_v2.1.29",
42+
"entry-hw": "git+https://github.com/entrylabs/entry-hw.git#dist/v1.9.69",
43+
"entry-js": "git+https://github.com/entrylabs/entryjs.git#dist/offline_v2.1.30",
4444
"entry-tool": "git+https://github.com/entrylabs/entry-tool.git#dist/20231026",
4545
"@entrylabs/legacy-video": "^1.0.0",
4646
"excel4node": "^1.7.0",

src/main/fileUtils.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import createLogger from './utils/functions/createLogger';
88
import ffmpeg from 'fluent-ffmpeg';
99
import ffmpegInstaller from '@ffmpeg-installer/ffmpeg';
1010
import ffprobeInstaller from '@ffprobe-installer/ffprobe';
11+
import Constants from './constants';
1112
import get from 'lodash/get';
1213

1314
type tarCreateOption = FileOptions & CreateOptions;
@@ -306,6 +307,23 @@ export default class {
306307
});
307308
});
308309

310+
static getExistSoundFilePath(sound: { filename: string; ext?: string }) {
311+
const basePath = Constants.resourceSoundPath(sound.filename);
312+
const defaultPath = `${basePath}${sound.filename}${sound.ext || '.mp3'}`;
313+
const alternativePath = `${basePath}sound/${sound.filename}${sound.ext || '.mp3'}`;
314+
315+
try {
316+
if (fs.existsSync(defaultPath)) {
317+
return defaultPath;
318+
} else {
319+
return alternativePath;
320+
}
321+
} catch (error) {
322+
console.warn('Sound file not found:', basePath, error);
323+
return alternativePath;
324+
}
325+
}
326+
309327
static getDuration = (soundInfo: any) => {
310328
const duration = get(soundInfo, ['format', 'duration'], 0);
311329
return Number(duration).toFixed(1);

src/main/ipcMainHelper.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import CommonUtils from './commonUtils';
77
import checkUpdateRequest from './utils/network/checkUpdate';
88
import createLogger from './utils/functions/createLogger';
99
import isValidAsarFile from './utils/functions/isValidAsarFile';
10+
import fileUtils from './fileUtils';
1011
require('@electron/remote/main').initialize();
1112

1213
const logger = createLogger('main/ipcMainHelper.ts');
@@ -46,6 +47,7 @@ new (class {
4647
ipcMain.handle('getOpenSourceText', () => ''); // 별다른 표기 필요없음
4748
ipcMain.handle('isValidAsarFile', this.checkIsValidAsarFile.bind(this));
4849
ipcMain.handle('saveSoundBuffer', this.saveSoundBuffer.bind(this));
50+
ipcMain.handle('getExistSoundFilePath', this.getExistSoundFilePath.bind(this));
4951
}
5052

5153
async saveProject(event: IpcMainInvokeEvent, project: ObjectLike, targetPath: string) {
@@ -253,6 +255,10 @@ new (class {
253255
return MainUtils.saveSoundBuffer(buffer, prevFileUrl);
254256
}
255257

258+
async getExistSoundFilePath(event: IpcMainInvokeEvent, sound: any) {
259+
return fileUtils.getExistSoundFilePath(sound);
260+
}
261+
256262
openUrl(event: IpcMainInvokeEvent, url: string) {
257263
logger.info(`openUrl called : ${url}`);
258264
shell.openExternal(url);

src/main/mainUtils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,10 +736,17 @@ export default class MainUtils {
736736
return Promise.all(
737737
sounds.map(async (sound) => {
738738
const fileName = sound.filename + (sound.ext || '.mp3');
739-
const soundResourcePath = path.join(
739+
let soundResourcePath = path.join(
740740
Constants.resourceSoundPath(sound.filename),
741741
fileName
742742
);
743+
if (!fs.existsSync(soundResourcePath)) {
744+
soundResourcePath = path.join(
745+
Constants.resourceSoundPath(sound.filename),
746+
'sound/',
747+
fileName
748+
);
749+
}
743750
const newObject = await MainUtils.importSoundToTemp(soundResourcePath);
744751

745752
sound.filename = newObject.filename;

src/renderer/helper/entry/entryModalHelper.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,23 +311,23 @@ class EntryModalHelper {
311311
*/
312312
static async showSoundPopup() {
313313
await this._switchPopup('sound', {
314-
fetch: (data: any) => {
315-
DatabaseManager.findAll(data).then((result) => {
314+
fetch: async (data: any) => {
315+
await DatabaseManager.findAll(data).then(async (result) => {
316316
EntryModalHelper.popup.setData({
317317
data: { data: result },
318318
});
319-
EntryUtils.loadSound(result as any[]);
319+
await EntryUtils.loadSound(result as any[]);
320320
});
321321
},
322-
search: (data: any) => {
322+
search: async (data: any) => {
323323
if (data.searchQuery === '') {
324324
return;
325325
}
326-
DatabaseManager.search(data, 'sound').then((result) => {
326+
await DatabaseManager.search(data, 'sound').then(async (result) => {
327327
EntryModalHelper.popup.setData({
328328
data: { data: result },
329329
});
330-
EntryUtils.loadSound(result as any[]);
330+
await EntryUtils.loadSound(result as any[]);
331331
});
332332
},
333333
submit: async (data: any) => {
@@ -369,7 +369,7 @@ class EntryModalHelper {
369369
const results = await IpcRendererHelper.importSounds(uploadFilePaths);
370370
createjs.Sound.stop();
371371

372-
EntryUtils.loadSound(results);
372+
await EntryUtils.loadSound(results);
373373
EntryModalHelper.popup.setData({
374374
data: {
375375
data: [], // 없으면 에러남. entry-tool 의 수정필요

src/renderer/helper/entry/entryUtils.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,9 @@ export default class {
8787
* 사운드 오브젝트 (from resources/db) 를 Entry.soundQueue 에 로드한다.
8888
* @param {Array<Object>} sounds
8989
*/
90-
static loadSound(sounds: any[] = []) {
91-
sounds.forEach((sound) => {
92-
const path =
93-
sound.path ||
94-
`${Constants.resourceSoundPath(sound.filename)}${sound.filename}${sound.ext}`;
90+
static async loadSound(sounds: any[] = []) {
91+
await sounds.forEach(async (sound) => {
92+
const path = await IpcRendererHelper.getExistSoundFilePath(sound);
9593
Entry.soundQueue.loadFile({
9694
id: sound._id,
9795
src: path,

src/renderer/helper/ipcRendererHelper.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,8 @@ export default class {
153153
static saveSoundBuffer(buffer: ArrayBuffer, prevFileUrl: string) {
154154
return ipcInvoke('saveSoundBuffer', buffer, prevFileUrl);
155155
}
156+
157+
static getExistSoundFilePath(sound: { filename: string; ext?: string }) {
158+
return ipcInvoke('getExistSoundFilePath', sound);
159+
}
156160
}

0 commit comments

Comments
 (0)