Skip to content
This repository was archived by the owner on Mar 11, 2020. It is now read-only.

Commit c80eeeb

Browse files
committed
Updated
1 parent 76de956 commit c80eeeb

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

index.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ const concat = require('concat-files')
1515
const async = require('async')
1616
const pjson = require('./package.json')
1717

18-
let op = ''
18+
let op = process.platform == 'win32' ? process.env.APPDATA : process.env.HOME + (process.platform == 'darwin' ? '/Library/Preferences' : '/.config')
1919
let download_list = []
2020
let mainWindow = null
21+
let appSettings = JSON.parse(fs.readFileSync(path.join(op, 'liveme-pro-tools/Settings')))
2122

2223
function createWindow() {
2324
mainWindow = new BrowserWindow({
@@ -61,19 +62,6 @@ function createWindow() {
6162

6263
})
6364

64-
op = ''
65-
if (process.platform == 'win32')
66-
op = process.env.APPDATA
67-
else if (process.platform == 'darwin')
68-
op = process.env.HOME + '/Library/Preferences'
69-
else
70-
op = process.env.HOME + '/.config'
71-
72-
op += '/liveme-pro-tools'
73-
74-
if (fs.existsSync(path.join(op, 'Settings'))) {
75-
appSettings = JSON.parse(fs.readFileSync(path.join(op, 'Settings')))
76-
}
7765
appSettings.path = op
7866

7967
global.appSettings = appSettings

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"request-promise-native": "^1.0.5"
2828
},
2929
"devDependencies": {
30-
"electron-builder": "^20.38.5",
3130
"electron": "^3.1.1"
3231
},
3332
"build": {

src/css/main.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ body {
55
color: rgb(224,224,224);
66
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
77
font-size: 10pt;
8+
overflow: hidden;
89
}
910

1011
h1,h2,h3,h4,h5,h6 {
@@ -18,6 +19,11 @@ h1,h2,h3,h4,h5,h6 {
1819
height: calc(100%-25px);
1920
overflow-x: hidden;
2021
overflow-y: auto;
22+
position: absolute;
23+
top: 0;
24+
bottom: 25px;
25+
left: 0;
26+
right: 0;
2127
}
2228

2329

src/js/index.js

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ let bookmarks = []
88
let bookmark_index = 0
99
let bookmarks_loading = false
1010

11-
let minuteTicks = 29
12-
let secondTicks = 45
11+
let minuteTicks = appSettings.lamd.cycletime - 1
12+
let secondTicks = 55
1313

1414
let isOnline = false
1515
let scan_active = false
1616

17+
let appPath = (process.platform == 'win32' ? process.env.APPDATA : process.env.HOME + (process.platform == 'darwin' ? '/Library/Preferences' : '/.config')) + '/liveme-pro-tools/'
18+
1719

1820
$(function(){
1921

@@ -81,9 +83,9 @@ $(function(){
8183
`)
8284
})
8385

84-
if (fs.existsSync(path.join(appSettings.path, 'bookmarks.json'))) {
86+
if (fs.existsSync(appPath + 'bookmarks.json')) {
8587
loadBookmarks()
86-
fs.watch(path.join(appSettings.path, 'bookmarks.json'), () => {
88+
fs.watch(appPath + 'bookmarks.json', () => {
8789
if (bookmarks_loading) return;
8890
bookmarks_loading = true;
8991
loadBookmarks()
@@ -104,27 +106,28 @@ $(function(){
104106

105107
secondTicks++
106108

107-
let t1 = 29 - minuteTicks
109+
let t1 = (appSettings.lamd.cycletime - 1) - minuteTicks
108110
let t2 = 60 - secondTicks
109111
if (t1 < 10) t1 = '0' + t1
110112
if (t2 < 10) t2 = '0' + t2
111113

112-
if (!scan_active && (minuteTicks > 20)) {
114+
if (!scan_active) {
113115
$('#statusbar h1').html(`Next scan in ${t1}:${t2}`)
114116
}
115117

116-
secondTicks = 0
117-
minuteTicks++
118+
if (secondTicks > 59) {
119+
secondTicks = 0
120+
minuteTicks++
118121

119-
if (minuteTicks > (appSettings.lamd.cycletime)) {
120-
minuteTicks = 0;
122+
if (minuteTicks == appSettings.lamd.cycletime) {
123+
minuteTicks = 0;
121124

122-
if (isOnline) {
123-
scan_active = true
124-
beginBookmarkScan()
125+
if (isOnline) {
126+
scan_active = true
127+
beginBookmarkScan()
128+
}
125129
}
126130
}
127-
128131
}, 1000)
129132

130133
})
@@ -138,9 +141,9 @@ function cancelDownload(i) {
138141

139142

140143
function loadBookmarks() {
141-
if (fs.existsSync(path.join(appSettings.path, 'bookmarks.json'))) {
144+
if (fs.existsSync(appPath + 'bookmarks.json')) {
142145
$('#statusbar h1').html('Loading bookmarks...')
143-
fs.readFile(path.join(appSettings.path, 'bookmarks.json'), 'utf8', function(err, data) {
146+
fs.readFile(appPath + 'bookmarks.json', 'utf8', function(err, data) {
144147
if (err) {
145148
bookmarks = []
146149
} else {
@@ -164,6 +167,8 @@ function beginBookmarkScan() {
164167
if (bookmarks[bookmark_index] != undefined) {
165168
if (bookmarks[bookmark_index].lamd != undefined) {
166169
if (bookmarks[bookmark_index].lamd.monitor == true) {
170+
console.log(`${bookmark_index} - Checking ${bookmarks[bookmark_index].nickname}`)
171+
167172
let t = Math.round((bookmark_index / bookmarks.length) * 100) + '%'
168173
$('#statusbar h1').html(`Scanning ${bookmarks[bookmark_index].nickname} (${bookmarks[bookmark_index].uid}) ${t}`)
169174
scanForNewReplays(bookmark_index)
@@ -177,8 +182,10 @@ function beginBookmarkScan() {
177182
} else {
178183
$('statusbar h1').html(`Bookmark scan complete.`)
179184

185+
scan_active = false
186+
180187
fs.writeFile(
181-
path.join(op, 'bookmarks.json'),
188+
appPath + 'bookmarks.json',
182189
JSON.stringify(bookmarks),
183190
() => {
184191

0 commit comments

Comments
 (0)