Skip to content
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

gds.fm launched new page #2486

Merged
merged 3 commits into from Jul 19, 2020

Conversation

heyarne
Copy link
Contributor

@heyarne heyarne commented Jul 17, 2020

Describe the changes you made
gds.fm moved from play.gds.fm to gds.fm and slightly changed the page layout. I updated the selectors and URL so it roughly works again. I have a question about I encountered though: .player-meta__title, which I chose as Connector.trackSelector only contains the track title. The track artist is in a sibling element… however on track change the artist is always appended to the title, with the artist also being detected independently. Any idea why that happens? Thanks for the addon, it's fantastic!

@inverse
Copy link
Member

inverse commented Jul 17, 2020

Thanks for taking the time to fix an integration. Can you give an example URL where this is working?

When I visit https://gds.fm/ and hit play nothing seems to get detected for me.

@alexesprit
Copy link
Member

alexesprit commented Jul 17, 2020

When I visit https://gds.fm/ and hit play nothing seems to get detected for me.

It's missing the Connector.playerSelector property.

Here's a working example (although it does not grabs track info):

'use strict';

Connector.playerSelector = '.page-header__logo-player';

Connector.artistSelector = '.player-meta__artist';

Connector.trackSelector = '.player-meta__title';

Connector.playButtonSelector = '.player-meta__icon--play';

@heyarne
Copy link
Contributor Author

heyarne commented Jul 18, 2020

Edit: Please ignore the following; I was debugging an old build 🤦. I have pushed the changes, it seems to work correctly now. The track meta data seems to be missing on the page sometimes, but I think there's not much you can do in those cases.

Old message for sake of completeness:

Maybe there's a misunderstanding on my side; I thought Connector.playerSelector is an optimization that I left out to make it easier to figure out why things are detected (or why they aren't).

I have added comments to the different selectors (I took out the overwritten callback, so this is the entire src/connectors/gds.fm.js):

'use strict';

// container wrapping all of the following selectors; this is done so the whole page doesn't have to be observed for mutations
Connector.playerSelector = '.player-meta'

// element containing *only* the artist name
Connector.artistSelector = '.player-meta__artist';

// element containing *only* the current track title
Connector.trackSelector = '.player-meta__title';

// if this element is found, nothing is playing; the song should be registered as playing by web-scrobbler as soon as this element disappears
// this is the opposite of Connector.pauseButtonSelector
Connector.playButtonSelector = '.player-meta__icon--play';

I have double-checked the selectors, they are correct if my understanding (that I made explicit in the comments) is correct. What happens with the above code however (I'm debugging this on Firefox 78) is:

  • When opening the page, no music is playing (i.e. the element .player-meta__icon--play is visible). Still, the track is immediately registered by the web-scrobbler extension
  • The parsed track contains the correct artist, but the track title looks like '$track $artist', which leads to the track not being found
  • When the track changes, the new track is parsed in exactly the same way.

So I'm pretty sure I'm misunderstanding something, even though the comments in the BaseConnector source code seem pretty clear.

@alexesprit alexesprit added bugfix connector This issue or pull request is related to connectors labels Jul 18, 2020
@alexesprit alexesprit merged commit 9d9b727 into web-scrobbler:master Jul 19, 2020
@alexesprit
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
connector This issue or pull request is related to connectors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants