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

Subsonicupdate plugin broken in multiple paces #4002

Closed
maffo999 opened this issue Jul 11, 2021 · 3 comments · Fixed by #4008
Closed

Subsonicupdate plugin broken in multiple paces #4002

maffo999 opened this issue Jul 11, 2021 · 3 comments · Fixed by #4008
Labels
bug bugs that are confirmed and actionable

Comments

@maffo999
Copy link
Contributor

maffo999 commented Jul 11, 2021

Problem

Running the latest git version of beets causes the subsonicupdate plugin to fail with a generic "Error: 1".
The current code is broken in 2 places:

  1. def __get_version(self):
    Code is trying to retrieve the version in order to decide whether to authenticate with token or password: a much better choice than my original plan of assuming everyone would use an updated version and/or prefer token over password due to additional security.
    In the current code, the REST API is called by passing only parameters 'c' and 'f': this API fails because it's not complete and the plugin stops processing.

  2. def start_scan(self):
    Assuming the authentication would go through, this call would fail anyway since the current code is splitting the API version in 3 values and passing them separately, e.g. &v=1&v=61&v=1, rather than &v=1.61.1

I have always been running an ancient version of beets with my original code for the plugin and I noticed this just today as I set up a new machine and installed beets form git repo through AUR.
It also seems I am the only user of this plugin given no other feedback has been filed so far, so I can understand if this fix doesn't get high priority.

Setup

  • OS: Arch Linux
  • Python version: 3.9.6
  • beets version: 1.5.0
  • Turning off plugins made problem go away (yes/no): disabling subsonicupdate plugin will prevent the error from happening

Additional Info

Subsonic API reference: http://www.subsonic.org/pages/api.jsp

@sampsyo sampsyo added the bug bugs that are confirmed and actionable label Jul 11, 2021
@sampsyo
Copy link
Member

sampsyo commented Jul 11, 2021

Agh; both of those seem bad! Thanks for the extremely clear explanation of what needs to be fixed.

@maffo999
Copy link
Contributor Author

No problem. I will try and see if I can help on this but Python is not really my thing.

@maffo999
Copy link
Contributor Author

this is my fix for the plugin.

  1. no more querying server for API version (you should know beforehand how to authenticate to the server in order to query it) -> added back "auth" option in config.yaml that will specify whether to authenticate with password or token
  2. hardcoded API versions 1.12.0 (passwordh auth) and 1.13.0 (token auth): I know this is not pretty and hard-coding things is not a best practice but considering point 1) I don't see any other way around it. The API to scan library is present in both 1.12.0 and 1.13.0 so this should not impact functionality at all

sampsyo added a commit that referenced this issue Jul 15, 2021
Fix for #4002: subsonicupdate plugin broken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs that are confirmed and actionable
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants