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

mpdstats records a skip when stopping playback #3722

Closed
aereaux opened this issue Aug 7, 2020 · 4 comments · Fixed by #3725
Closed

mpdstats records a skip when stopping playback #3722

aereaux opened this issue Aug 7, 2020 · 4 comments · Fixed by #3725
Labels
needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature."

Comments

@aereaux
Copy link
Contributor

aereaux commented Aug 7, 2020

Problem

I am using the mpdstats plugin. Running beet mpdstats and then starting a song playing in mpd and then stopping it makes mpdstats record a skip and adjust the song rating downwards, even though that song remains at the beginning of the mpd playlist (i.e. it's not actually skipped). Interestingly pausing and then later stopping seems to not cause this problem.

Setup

  • OS: Arch Linux
  • Python version: 3.8.5
  • beets version: b89a265
  • Turning off plugins made problem go away (yes/no): Well... yes?

My configuration (output of beet config) is:

plugins: parentwork scrub info mbsync alternatives chroma mpdstats
directory: ~/music/beets/

paths:
    default: '%ifdef{parent_composer_sort,$parent_composer_sort,[unknown]}/%ifdef{parentwork_date,$parentwork_date - }%ifdef{parentwork,$parentwork,[unknown]}/%ifdef{year,$year - }$album%aunique{album year,albumartist albumtype label catalognum albumdisambig releasegroupdisambig}/$track $title'

import:
    from_scratch: yes
    move: yes
acoustid:
    apikey: REDACTED
alternatives:
    aphone:
        directory: /home/user/music/aphone/
        formats: opus
        query: ''
parentwork:
    auto: no
    force: no
chroma:
    auto: yes
mpd:
    music_directory: /home/user/music/beets
    rating: yes
    rating_mix: 0.75
    host: localhost
    port: 6600
    password: REDACTED
scrub:
    auto: yes
@aereaux
Copy link
Contributor Author

aereaux commented Aug 8, 2020

Looking at this a bit more, it looks like this happens because handle_song_change is called before the expected end time of the song, so it sorta looks like a skip. Perhaps we could check the state of the playlist? Not sure what the best way to fix this would be.

@sampsyo sampsyo added the needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature." label Aug 8, 2020
@sampsyo
Copy link
Member

sampsyo commented Aug 8, 2020

Indeed; sounds like trouble! I'm not too familiar with the inner workings of the "state machine" that makes mpdstats tick, but maybe there's a way to tell whether handle_song_change happens when we're just paused on the current song vs. now playing a different song?

@aereaux
Copy link
Contributor Author

aereaux commented Aug 8, 2020

It's a little more complicated than that, I think. mpd has the ability to pause or stop, and the latter is more like just pausing back to the beginning of the current track. Beets mpdstats already seems to report pauses (which work fine) and stops, but we can't just change the handling of stops wholesale because I think that it also stops at the end of the playlist/queue (although I need to do some more testing for this).

@aereaux
Copy link
Contributor Author

aereaux commented Aug 10, 2020

OK, I looked into this more and created a PR with my best idea for how to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature."
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants