@@ -8,12 +8,14 @@ let bookmarks = []
8
8
let bookmark_index = 0
9
9
let bookmarks_loading = false
10
10
11
- let minuteTicks = 29
12
- let secondTicks = 45
11
+ let minuteTicks = appSettings . lamd . cycletime - 1
12
+ let secondTicks = 55
13
13
14
14
let isOnline = false
15
15
let scan_active = false
16
16
17
+ let appPath = ( process . platform == 'win32' ? process . env . APPDATA : process . env . HOME + ( process . platform == 'darwin' ? '/Library/Preferences' : '/.config' ) ) + '/liveme-pro-tools/'
18
+
17
19
18
20
$ ( function ( ) {
19
21
@@ -81,9 +83,9 @@ $(function(){
81
83
` )
82
84
} )
83
85
84
- if ( fs . existsSync ( path . join ( appSettings . path , 'bookmarks.json' ) ) ) {
86
+ if ( fs . existsSync ( appPath + 'bookmarks.json' ) ) {
85
87
loadBookmarks ( )
86
- fs . watch ( path . join ( appSettings . path , 'bookmarks.json' ) , ( ) => {
88
+ fs . watch ( appPath + 'bookmarks.json' , ( ) => {
87
89
if ( bookmarks_loading ) return ;
88
90
bookmarks_loading = true ;
89
91
loadBookmarks ( )
@@ -104,27 +106,28 @@ $(function(){
104
106
105
107
secondTicks ++
106
108
107
- let t1 = 29 - minuteTicks
109
+ let t1 = ( appSettings . lamd . cycletime - 1 ) - minuteTicks
108
110
let t2 = 60 - secondTicks
109
111
if ( t1 < 10 ) t1 = '0' + t1
110
112
if ( t2 < 10 ) t2 = '0' + t2
111
113
112
- if ( ! scan_active && ( minuteTicks > 20 ) ) {
114
+ if ( ! scan_active ) {
113
115
$ ( '#statusbar h1' ) . html ( `Next scan in ${ t1 } :${ t2 } ` )
114
116
}
115
117
116
- secondTicks = 0
117
- minuteTicks ++
118
+ if ( secondTicks > 59 ) {
119
+ secondTicks = 0
120
+ minuteTicks ++
118
121
119
- if ( minuteTicks > ( appSettings . lamd . cycletime ) ) {
120
- minuteTicks = 0 ;
122
+ if ( minuteTicks == appSettings . lamd . cycletime ) {
123
+ minuteTicks = 0 ;
121
124
122
- if ( isOnline ) {
123
- scan_active = true
124
- beginBookmarkScan ( )
125
+ if ( isOnline ) {
126
+ scan_active = true
127
+ beginBookmarkScan ( )
128
+ }
125
129
}
126
130
}
127
-
128
131
} , 1000 )
129
132
130
133
} )
@@ -138,9 +141,9 @@ function cancelDownload(i) {
138
141
139
142
140
143
function loadBookmarks ( ) {
141
- if ( fs . existsSync ( path . join ( appSettings . path , 'bookmarks.json' ) ) ) {
144
+ if ( fs . existsSync ( appPath + 'bookmarks.json' ) ) {
142
145
$ ( '#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 ) {
144
147
if ( err ) {
145
148
bookmarks = [ ]
146
149
} else {
@@ -164,6 +167,8 @@ function beginBookmarkScan() {
164
167
if ( bookmarks [ bookmark_index ] != undefined ) {
165
168
if ( bookmarks [ bookmark_index ] . lamd != undefined ) {
166
169
if ( bookmarks [ bookmark_index ] . lamd . monitor == true ) {
170
+ console . log ( `${ bookmark_index } - Checking ${ bookmarks [ bookmark_index ] . nickname } ` )
171
+
167
172
let t = Math . round ( ( bookmark_index / bookmarks . length ) * 100 ) + '%'
168
173
$ ( '#statusbar h1' ) . html ( `Scanning ${ bookmarks [ bookmark_index ] . nickname } (${ bookmarks [ bookmark_index ] . uid } ) ${ t } ` )
169
174
scanForNewReplays ( bookmark_index )
@@ -177,8 +182,10 @@ function beginBookmarkScan() {
177
182
} else {
178
183
$ ( 'statusbar h1' ) . html ( `Bookmark scan complete.` )
179
184
185
+ scan_active = false
186
+
180
187
fs . writeFile (
181
- path . join ( op , 'bookmarks.json' ) ,
188
+ appPath + 'bookmarks.json' ,
182
189
JSON . stringify ( bookmarks ) ,
183
190
( ) => {
184
191
0 commit comments