-
-
Notifications
You must be signed in to change notification settings - Fork 538
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
Issue #1817 Xiami scrobbler error fixed #1848
Conversation
src/connectors/xiami.js
Outdated
return Util.stringToSeconds(text); | ||
let text = $('.audio-progress .range .bar .handle').val(); | ||
let str = text.split('/'); | ||
return str[0]; |
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.
Is this correct? Isn't 0
the currentTime not the duration? Could we cover currentTime as well as I saw it was removed.
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.
When the page's music is playing, currentTimes is viewed like 01:03/04:12.
So i get currentTime using
let str = text.split('/');
return str[0];
If it don't be needed, I'll remove it and commit it again.
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.
I still think this is wrong. so text will contain 00:30/02:45
for example and splitting this will yeild 00:30
in position 0
... which is the current time - not the duration. Does that make sense?
Perhaps a better solution would be to just set
Connector.timeInfoSelector = '.audio-progress .range .bar .handle';
This handles the case when the duration and remaining time is in this format.
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.
I still think this is wrong. so text will contain
00:30/02:45
for example and splitting this will yeild00:30
in position0
... which is the current time - not the duration. Does that make sense?Perhaps a better solution would be to just set
Connector.timeInfoSelector = '.audio-progress .range .bar .handle';
This handles the case when the duration and remaining time is in this format.
Oh.. I understand!
I modified duration part just now.
Is it right?
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.
Due to the way it's provided in a single element divided by /
I'd go for the solution I proposed.
See here for more context: https://github.com/web-scrobbler/web-scrobbler/blob/master/src/core/content/connector.js#L217
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.
Sounds good. Is there any things that have to changed?
}; | ||
|
||
Connector.getUniqueID = () => $('.ui-track-current .c1').data('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.
Is there no way to get uniqId?
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.
I could not find a way to get an uniqId from the website.
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.
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.
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.
@naoyeye
Oh Thanks!!
I'll try it now. But can you explain the getUniqueId why it is needed?
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.
@KwonDae read the docblock above the following: https://github.com/web-scrobbler/web-scrobbler/blob/master/src/core/content/connector.js#L251
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.
Looks good aside the duration part.
@@ -293,7 +293,7 @@ define(function() { | |||
|
|||
{ | |||
label: 'Xiami', | |||
matches: ['*://www.xiami.com/play*'], | |||
matches: ['*://www.xiami.com/*'], |
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.
need to consider the case no slash at the end? e.g https://www.xiami.com
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.
Should match since *
is wildcard
@KwonDae any update? |
This codes are working well in my local laptop(MacOs). |
Moreover, It seems that player site was changed 'https://www.xiami.com/play' to 'https://www.xiami.com'. So i modified some codes about that part. |
let str = text.split('/'); | ||
return str[0]; | ||
}; | ||
Connector.timeInfoSelector = '.audio-progress .range .bar .handle'; |
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.
@inverse
Is this right your proposed?
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.
looks good to me!
@@ -8,6 +8,8 @@ Connector.artistSelector = '.music .info .singers'; | |||
|
|||
Connector.trackArtSelector = '.music .cover-link .active img'; | |||
|
|||
Connector.getUniqueID = () => $('.play-bar .content .title').attr('href').split('?')[0].split('/song/')[1]; |
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.
Thanks a lot! |
not working now |
Can you explain detail? |
About #1817 ,
Because Xiami's design changed, I changed the some codes in Xiamai.js .
If there's anything wrong, I'd appreciate it if you let me know :)
Thanks.