Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
added moment lib to fix time
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianPetkovsek committed Sep 17, 2018
1 parent af2c9d3 commit 7b6e1d8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
16 changes: 7 additions & 9 deletions modules/youtube-js/get-youtube.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//code
getEpochTime = function(){return Math.round((new Date()).getTime() / 1000)};
const moment = require('moment');

hasSeeked = false;
getInfos = `(function(){
Expand Down Expand Up @@ -57,15 +57,13 @@ async function injectRun(mainWindow) {
if (videoDuration && videoCurrentTime) {
if (!isLive){
if (!videoPaused){
vidDur = videoDuration;
vidCurtime = videoCurrentTime;
let now = moment.utc(),
remaining = moment.duration(videoDuration - videoCurrentTime, 'seconds');
endTimestamp = now.add(remaining).unix();
global.hasSeeked = videoCurrentTimeTemp != Math.floor(endTimestamp)
videoCurrentTimeTemp = Math.floor(endTimestamp)

a = getEpochTime()+(vidDur - vidCurtime);

global.hasSeeked = videoCurrentTimeTemp != Math.floor(a)
videoCurrentTimeTemp = Math.floor(a)

rpcData.endTimestamp = a;
rpcData.endTimestamp = endTimestamp;
rpcData.state = 'By: '+ creator;
}else{
videoName += ' By: '+ creator;
Expand Down
8 changes: 5 additions & 3 deletions package-lock.json

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

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"dependencies": {
"discord-rpc": "^3.0.0",
"electron-widevinecdm": "^5.0.2",
"moment": "^2.22.2",
"q": "git+https://github.com/kriskowal/q.git",
"request": "^2.88.0",
"temp-write": "^3.4.0",
Expand All @@ -72,5 +73,9 @@
"win32Dependencies": {
"electron-widevinecdm": "^5.0.2"
},
"os" : [ "win32", "!darwin", "!linux" ]
"os": [
"win32",
"!darwin",
"!linux"
]
}
1 change: 1 addition & 0 deletions slider-to-add.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://previews.envatousercontent.com/files/202191611/index.html

0 comments on commit 7b6e1d8

Please sign in to comment.