Skip to content

Conversation

@xDimGG
Copy link

@xDimGG xDimGG commented Dec 3, 2017

tell me if you dont like anything ( or dont like everything )

@Phineas
Copy link
Contributor

Phineas commented Dec 4, 2017

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.

Copy link
Collaborator

@cernodile cernodile left a 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';
Copy link
Collaborator

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}`;
Copy link
Collaborator

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}`;
Copy link
Collaborator

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15e3?

Copy link
Author

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

Copy link
Collaborator

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;
Copy link
Collaborator

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.

lloti added 2 commits December 4, 2017 10:51
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.
Copy link
Collaborator

@cernodile cernodile left a 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';
Copy link
Collaborator

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);
Copy link
Collaborator

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?

Copy link
Collaborator

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.

Copy link
Collaborator

@cernodile cernodile left a 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.

@Phineas
Copy link
Contributor

Phineas commented Dec 4, 2017

Will test & merge tomorrow :)

@Phineas
Copy link
Contributor

Phineas commented Dec 5, 2017

Timer still doesn't disappear when paused for me & theres still a delay when I do anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants