Skip to content

re-write - #36

Open
xDimGG wants to merge 8 commits into
nations:masterfrom
xDimGG:master
Open

re-write#36
xDimGG wants to merge 8 commits into
nations:masterfrom
xDimGG:master

Conversation

@xDimGG

@xDimGG xDimGG commented Dec 3, 2017

Copy link
Copy Markdown

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

@Phineas

Phineas commented Dec 4, 2017

Copy link
Copy Markdown
Contributor

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.

@cernodile cernodile left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread app.js Outdated
});
}
try {
const path = process.platform === 'win32' ? 'C:\\Windows\\System32\\drivers\\etc\\hosts' : '/hosts/etc';

Copy link
Copy Markdown
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

Comment thread app.js Outdated
activity.smallImageKey = image;
if (song) {
activity.details = `🎵 ${song.title}`;
activity.state = `👤 ${song.artist.name}`;

Copy link
Copy Markdown
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.

Comment thread app.js Outdated
activity.details = `🎵 ${song.title}`;
activity.state = `👤 ${song.artist.name}`;
activity.largeImageText = `🔗 ${song.id}`;
activity.smallImageText = `💿 ${song.album.id}`;

Copy link
Copy Markdown
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.

Comment thread 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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

15e3?

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread spotify.js

class Song {
constructor(data) {
this.title = data.track.track_resource.name;

Copy link
Copy Markdown
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.

@cernodile cernodile left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread 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
Copy Markdown
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.

Comment thread app.js Outdated
time = Date.now();
}, timeLeft);
} else {
client.setActivity(activity);

Copy link
Copy Markdown
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
Copy Markdown
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.

@cernodile cernodile left a comment

Copy link
Copy Markdown
Collaborator

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

Phineas commented Dec 4, 2017

Copy link
Copy Markdown
Contributor

Will test & merge tomorrow :)

@Phineas

Phineas commented Dec 5, 2017

Copy link
Copy Markdown
Contributor

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