-
Notifications
You must be signed in to change notification settings - Fork 40
re-write #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
re-write #36
Conversation
|
Looks good, could you add the timer pause feature when the song gets paused tho? Also, when I do anything on Spotify, it takes around 10 seconds to update on Discord. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix /hosts/etc, make checks for win32 platform to discover installation path, create additional data checks in case of local files.
app.js
Outdated
| }); | ||
| } | ||
| try { | ||
| const path = process.platform === 'win32' ? 'C:\\Windows\\System32\\drivers\\etc\\hosts' : '/hosts/etc'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not everyone has it on C drive, plus there's one more win32 system that allows to change install path + it's /etc/hosts for Linux
app.js
Outdated
| activity.smallImageKey = image; | ||
| if (song) { | ||
| activity.details = `🎵 ${song.title}`; | ||
| activity.state = `👤 ${song.artist.name}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if song.artist is undefined, never happens on normal songs, but would happen on local files.
app.js
Outdated
| activity.details = `🎵 ${song.title}`; | ||
| activity.state = `👤 ${song.artist.name}`; | ||
| activity.largeImageText = `🔗 ${song.id}`; | ||
| activity.smallImageText = `💿 ${song.album.id}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as song.artist, this can cause troubles on local files.
app.js
Outdated
| log(`Song state updated (playing: ${song.playing})`) | ||
| client.on('ready', () => { | ||
| log(`Connected to Discord! (${cfg.id})`); | ||
| setInterval(() => client.setActivity(activity), 15e3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
15e3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
15e3 = 15000 = 15 * 10 ^ 3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the user changes song? It would create quite a noticeable gap.
|
|
||
| class Song { | ||
| constructor(data) { | ||
| this.title = data.track.track_resource.name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add checks for data incase of local files.
Previous method of setting the presence every 15 seconds was removed, instead it just checks how long it's been since you last updated it.
cernodile
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've mitigated the primary issues. There are some still problems remaining, good job though.
app.js
Outdated
| **/ | ||
| try { | ||
| const path = process.platform === 'win32' ? 'C:\\Windows\\System32\\drivers\\etc\\hosts' : '/hosts/etc'; | ||
| const path = process.platform === 'win32' ? 'C:\\Windows\\System32\\drivers\\etc\\hosts' : '/etc/hosts'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about win32, not every installation is at C:\ nor \Windows. Use %SystemRoot% to your advantage.
app.js
Outdated
| time = Date.now(); | ||
| }, timeLeft); | ||
| } else { | ||
| client.setActivity(activity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"else it'll set a timeout until we can", yet it sets activity either way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm, OP clarified this to me in Discord. I misunderstood.
cernodile
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than spotify.js, this rewrite seems clean enough now.
|
Will test & merge tomorrow :) |
|
Timer still doesn't disappear when paused for me & theres still a delay when I do anything. |
tell me if you dont like anything ( or dont like everything )