Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit 7e94499

Browse files
committed
trying to do some filesystem tails.
1 parent 1e6aebc commit 7e94499

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

‎client/client.js‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
var gui = require('nw.gui')
22
, moment = require('moment')
3+
, fs = require('fs')
4+
, Tail = require('tail').Tail
35

46
function startSpinner() { $('#bottom-menu-spinner').fadeIn(1500); }
57
function stopSpinner() { $('#bottom-menu-spinner').fadeOut(1500); }
@@ -9,7 +11,7 @@ function pollClipboard() {
911
setTimeout(function() {
1012
var cb = gui.Clipboard.get();
1113
var clipboard = document.getElementById('clipboard')
12-
var event = {'type': 'report', 'time': moment().utc().format('HH:mm:ss'), 'text': cb.get('text')};
14+
var event = {'type': 'clipboard', 'time': moment().utc().format('HH:mm:ss'), 'text': cb.get('text')};
1315

1416
var renderedEvent = $(Templates.event(event))
1517
$('#clipboard').prepend(renderedEvent);
@@ -19,8 +21,40 @@ function pollClipboard() {
1921
}, 10000);
2022
}
2123

24+
function tailLogs() {
25+
if (process.platform === 'win32') {
26+
var path = '%userprofile%\\documents\\EVE\\logs\\Chatlogs\\'
27+
} else {
28+
var path = '/Users/rcreasey/Library/Application\ Support/EVE\ Online/p_drive/User/My\ Documents/EVE/logs/Chatlogs/'
29+
}
30+
31+
console.log( path )
32+
var logs = fs.readdirSync(path)
33+
.map(function(v) {
34+
return { name:v,
35+
time:fs.statSync(path + v).mtime.getTime()
36+
};
37+
})
38+
.sort(function(a, b) { return a.time - b.time; })
39+
.map(function(v) { return v.name; } );
40+
41+
console.log( logs )
42+
43+
44+
// var tail = new Tail( path + filename );
45+
// tail.on('line', function(data) {
46+
// startSpinner();
47+
// var event = {'type': 'log', 'time': moment().utc().format('HH:mm:ss'), 'text': data};
48+
// var renderedEvent = $(Templates.event(event))
49+
// $('#clipboard').prepend(renderedEvent);
50+
//
51+
// stopSpinner();
52+
// });
53+
}
54+
2255
window.onload = function() {
2356
stopSpinner();
2457
pollClipboard();
58+
tailLogs();
2559
gui.Window.get().show();
2660
}

‎client/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"min_height": 220
1515
},
1616
"dependencies": {
17-
"moment": "^2.8.3"
17+
"moment": "^2.8.3",
18+
"tail": "^0.4.0"
1819
}
1920
}

0 commit comments

Comments
 (0)