Skip to content

Commit

Permalink
#4, #9 Add multiple songs to playlist + Add repeat option
Browse files Browse the repository at this point in the history
  • Loading branch information
jviaches committed Apr 3, 2022
1 parent 6aae2d2 commit 9c804c9
Show file tree
Hide file tree
Showing 10 changed files with 248 additions and 276 deletions.
24 changes: 20 additions & 4 deletions app/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/main.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 24 additions & 4 deletions app/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { app, BrowserWindow, screen } from 'electron';
import { app, BrowserWindow, dialog, screen } from 'electron';
import * as path from 'path';
import * as fs from 'fs';
import * as url from 'url';
import * as remoteMain from '@electron/remote/main'
import { json } from 'stream/consumers';

let win: BrowserWindow = null;

const args = process.argv.slice(1),
serve = args.some(val => val === '--serve');

Expand All @@ -19,16 +22,22 @@ function createWindow(): BrowserWindow {
nodeIntegration: true,
allowRunningInsecureContent: (serve) ? true : false,
contextIsolation: false, // false if you want to run e2e test with Spectron
plugins: true,
backgroundThrottling: false,
nativeWindowOpen: false,
webSecurity: false
},
titleBarStyle: 'hiddenInset',
frame: false,
resizable: false,
transparent: true,
minimizable: false,
maximizable: false,
closable: false
closable: false,
});

remoteMain.enable(win.webContents);


if (serve) {
win.webContents.openDevTools();
Expand All @@ -52,9 +61,20 @@ function createWindow(): BrowserWindow {
}));
}

win.webContents.on("ipc-message", (event, input, args) => {
win.webContents.on('ipc-message', (event, input, args) => {

if (input === 'open-file-dialog') {
dialog.showOpenDialog(null, {
properties: ['openFile', 'multiSelections'],
filters: [{ name: 'MP3 Media files', extensions: ['mp3'] }],
}).then( res => {
if (res.filePaths) {
win.webContents.send("add-media", res.filePaths);
}
});
}

if (input === "resize-app") {
if (input === 'resize-app') {
win.resizable = true;
win.setSize(win.getSize()[0], args);
win.resizable = false;
Expand Down
Loading

0 comments on commit 9c804c9

Please sign in to comment.