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

Added missing distinct fields so they match search #1900

Merged
merged 10 commits into from
Jan 25, 2022

Conversation

kingosticks
Copy link
Member

@kingosticks kingosticks commented Apr 18, 2020

Also added the musicbrainz_* and disc_no fields.

This still needs a changelog entry, I guess it's a feature release?. Technically any frontend that supports distinct (!) and was trying to use field='track', will find that no longer works. So maybe this is a breaking change.. oops.

@codecov
Copy link

codecov bot commented Apr 18, 2020

Codecov Report

Merging #1900 into develop will increase coverage by 0.01%.
The diff coverage is 85.71%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1900      +/-   ##
===========================================
+ Coverage    76.91%   76.93%   +0.01%     
===========================================
  Files           55       55              
  Lines         4669     4673       +4     
===========================================
+ Hits          3591     3595       +4     
  Misses        1078     1078              
Impacted Files Coverage Δ
mopidy/internal/deprecation.py 75.00% <ø> (ø)
mopidy/core/library.py 98.05% <75.00%> (+0.03%) ⬆️
mopidy/internal/validation.py 98.27% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5fc846...c026cfb. Read the comment docs.

@kingosticks kingosticks self-assigned this Apr 18, 2020
@kingosticks kingosticks added A-core Area: Core layer C-enhancement Category: A PR with an enhancement or an issue with an enhancement proposal labels Apr 18, 2020
@kingosticks
Copy link
Member Author

A problem I have introduced here is that core.library.get_distinct expects backends to return a list of str. But with expanding the allowed field to include track_no and disc_no, we can now also get a list of int.

@kingosticks
Copy link
Member Author

kingosticks commented Apr 19, 2020

Hmm, any backend with a get_distinct() that was responding to field='track' will now be broken. So actually I need to map 'track_name' back to 'track' and log a deprecated warning for 'track'.

Fortunately, very few backends support get_distinct():

I can submit PRs for these.

@kingosticks
Copy link
Member Author

This has turned into a bit of a mess.

mopidy/core/library.py Outdated Show resolved Hide resolved
@jodal jodal added this to the v3.1.0 milestone Apr 21, 2020
@kingosticks
Copy link
Member Author

kingosticks commented Apr 22, 2020

Remaining issues are:

  • Backends returning lists of int
  • Backwards compatibility and my hack

mopidy/core/library.py Outdated Show resolved Hide resolved
kingosticks and others added 7 commits January 21, 2022 00:58
With the exception of 'any' as it doesn't make sense here.

Also added some basic get_distinct tests.
…bility.

Warn that 'track' is deprecated. Backends should handle both in the short-term.
Co-Authored-By: Stein Magnus Jodal <stein.magnus@jodal.no>
Frontends should use 'track_name'' instead.
@kingosticks
Copy link
Member Author

kingosticks commented Jan 21, 2022

OK, I think this version is clearer (less magic) and fixed CI failures.

mopidy/internal/validation.py Show resolved Hide resolved
tests/core/test_library.py Outdated Show resolved Hide resolved
tests/core/test_library.py Outdated Show resolved Hide resolved
tests/core/test_library.py Outdated Show resolved Hide resolved
tests/core/test_library.py Outdated Show resolved Hide resolved
tests/core/test_library.py Outdated Show resolved Hide resolved
tests/core/test_library.py Outdated Show resolved Hide resolved
Copy link
Member Author

@kingosticks kingosticks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wanted to reply to comments but seems I've done a review!

mopidy/internal/validation.py Show resolved Hide resolved
tests/core/test_library.py Outdated Show resolved Hide resolved
@kingosticks kingosticks merged commit 24f1fb7 into mopidy:develop Jan 25, 2022
@kingosticks kingosticks deleted the fix/distinct-fields branch January 25, 2022 15:51
@kingosticks kingosticks mentioned this pull request Aug 16, 2023
@jodal jodal modified the milestones: v3.4.0, v3.3.0 Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core layer C-enhancement Category: A PR with an enhancement or an issue with an enhancement proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants