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

"How to make sure that the song tagged by Shazam was longer than 30 seconds?" #16

Closed
hugovk opened this Issue Oct 1, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@hugovk
Contributor

hugovk commented Oct 1, 2015

I just got hit by a radio station playing lots of snippets of songs in succession.

At least one method of validation is not to scrobble until at least 30 seconds have elapsed. If a new track has come in from Shazam in those 30 seconds, then don't scrobble.

You can (and it'd be a great addition) to send a now playing notification as soon as a track starts playing, but wait on the scrobble one until later.


For reference:

For every track a user listens to the client should send a track.updateNowPlaying request and a track.scrobble request. ...

The "Now Playing" service lets a client notify Last.fm that a user has started listening to a track. This does not affect a user's charts, but will feature the current track on their profile page, along with an indication of what music player they're using. ...

A track should only be scrobbled when the following conditions have been met:

  • The track must be longer than 30 seconds.
  • And the track has been played for at least half its duration, or for 4 minutes (whichever occurs earlier.)

As soon as these conditions have been met, the scrobble request may be sent at any time. It is often most convenient to send a scrobble request when a track has finished playing.

http://www.last.fm/api/scrobbling

@stephanebruckert

This comment has been minimized.

Show comment
Hide comment
@stephanebruckert

stephanebruckert Oct 1, 2015

Owner

The thing is that Shazam only sends one notification per song, no matter how long the song has been played. So this is not about the Last.fm API.

The solution suggested on the README needs to be tested.

How to make sure that the song tagged by Shazam was longer than 30 seconds?
TODO: reset Shazam tags after each tag, then get the same tag again and again until we know if the song were played long enough.

Owner

stephanebruckert commented Oct 1, 2015

The thing is that Shazam only sends one notification per song, no matter how long the song has been played. So this is not about the Last.fm API.

The solution suggested on the README needs to be tested.

How to make sure that the song tagged by Shazam was longer than 30 seconds?
TODO: reset Shazam tags after each tag, then get the same tag again and again until we know if the song were played long enough.

@hugovk

This comment has been minimized.

Show comment
Hide comment
@hugovk

hugovk Oct 3, 2015

Contributor

TODO: reset Shazam tags after each tag, then get the same tag again and again until we know if the song were played long enough.

Does that mean wiping the list of songs in the Shazam drop down? Would people find it annoying? Shazam might not like it.


The thing is that Shazam only sends one notification per song, no matter how long the song has been played. So this is not about the Last.fm API.

Agreed. All we know is:

  • A track started.
  • Either:
    • another new track started within 30 seconds
    • no new track started within 30 seconds

Pseudocode:

-> new track notification:
  time_track_started = now
  lastfm.set_now_playing(track)

  wait up to 30 seconds...

  if no new track notification in 30 seconds: 
    lastfm.set_scrobbled(track)

  if new track notification in less than 30 seconds:
    # don't scrobble (track)
    # go back to the top
Contributor

hugovk commented Oct 3, 2015

TODO: reset Shazam tags after each tag, then get the same tag again and again until we know if the song were played long enough.

Does that mean wiping the list of songs in the Shazam drop down? Would people find it annoying? Shazam might not like it.


The thing is that Shazam only sends one notification per song, no matter how long the song has been played. So this is not about the Last.fm API.

Agreed. All we know is:

  • A track started.
  • Either:
    • another new track started within 30 seconds
    • no new track started within 30 seconds

Pseudocode:

-> new track notification:
  time_track_started = now
  lastfm.set_now_playing(track)

  wait up to 30 seconds...

  if no new track notification in 30 seconds: 
    lastfm.set_scrobbled(track)

  if new track notification in less than 30 seconds:
    # don't scrobble (track)
    # go back to the top
@stephanebruckert

This comment has been minimized.

Show comment
Hide comment
@stephanebruckert

stephanebruckert Oct 4, 2015

Owner

Totally agree with everything you said. Let's do this!

Owner

stephanebruckert commented Oct 4, 2015

Totally agree with everything you said. Let's do this!

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