Skip to content

Commit

Permalink
Stop using a "FILENAME" global variables, it doesn't always work
Browse files Browse the repository at this point in the history
  • Loading branch information
Elanis committed Apr 30, 2022
1 parent bfcbff3 commit 1bf6f15
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions main.server.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import fs from 'fs';
import path from 'path';

const FILENAME = path.join(config['amazon']['folder'], 'Digital.PrimeVideo.Viewinghistory.csv');

export default class AmazonCalendar {
static init() {
AmazonCalendar.importAmazonPrimeVideoActivity();

const watcher = fs.watch(FILENAME, { persistent: false }, (curr, prev) => {
const watcher = fs.watch(path.join(config['amazon']['folder'], 'Digital.PrimeVideo.Viewinghistory.csv'), { persistent: false }, (curr, prev) => {
watcher.close();

log('./reloading.STATS.AmazonPrime', 'boot');
Expand Down Expand Up @@ -56,7 +54,7 @@ export default class AmazonCalendar {
)).rows[0].min;
minDate.setHours(minDate.getHours() - 6); // Safety margin

const file = fs.readFileSync(FILENAME).toString();
const file = fs.readFileSync(path.join(config['amazon']['folder'], 'Digital.PrimeVideo.Viewinghistory.csv')).toString();

let firstLineSkipped = false;
for(const line of file.split('\n')) {
Expand Down

0 comments on commit 1bf6f15

Please sign in to comment.