Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Stop displaying the same artist/albums multiple times #181

Closed
wants to merge 12 commits into from

Conversation

jason-a69
Copy link

Changes made for issue #139

Copy link
Contributor

@belak belak left a comment

Choose a reason for hiding this comment

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

I do understand why this works... it relies on duplicate artists and albums having the same name and grouping the artist/album IDs together.

However, this makes it impossible to add multiple artists with the same name to a library. Additionally, it may cause false positives with albums (As an example, I'm sure there are multiple artists with albums called "Greatest Hits").

I'm pretty sure the duplicate albums are caused by clean/explicit tracks... but I'm not sure what's causing the duplicate artists - I haven't seen that before.

I'd be willing to accept the album workaround if it also checks the artist... even though I'm not completely sure that would be the best solution. It would be impossible for an artist to have multiple albums with the same name, but it's a much smaller edge case.

Thanks for spending the time on this!

EDIT: It looks like flake8 may have crashed when running in CI, but there are a few linting violations in this PR which I'd like to see fixed before it's merged, if possible.

@@ -311,14 +313,30 @@ def sorter(track):
def refresh(self, uri=None):
self.tracks = {}
self.albums = {}
self.albums2 = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be named something a bit more descriptive? It's always nice to be able to look at a variable and get a bit of context about how it's used.

Copy link
Author

Choose a reason for hiding this comment

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

Can do, no problem


self.albums2[mopidy_track.album.uri] = mopidy_track.album
album_found = False
if len(self.albums) > 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

I would just drop this if-else and use the for loop all the time. Looping over an empty list shouldn't be very expensive.

Copy link
Author

Choose a reason for hiding this comment

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

OK, sure

@jason-a69
Copy link
Author

I will put in a check for artist / album name to make sure album does not exist

…bumartist is not

converted to lowercase. Previous function would return "Black Sabbath" albums if searching for
all albums by "Abba" (because abba is a substring of sabbath)
@jason-a69
Copy link
Author

I have done further changes, that's me done unless you want me to do anything else.

@belak
Copy link
Contributor

belak commented Nov 2, 2017

I'll try to take another look later.

Additionally, could you please make sure flake8 (code style checks) passes for the portions you've changed (It's the part of the travis-ci build that's failing)? There's some information on how to install and run it yourself at http://flake8.pycqa.org/en/latest/.

@kingosticks
Copy link
Member

You know you can run flake8 locally, right? The whole Travis run can be reproduced locally with tox.

@jason-a69
Copy link
Author

jason-a69 commented Nov 10, 2017 via email

@kingosticks
Copy link
Member

I have been there myself. https://docs.mopidy.com/en/latest/devenv/# is really worth doing. It doesn't take that long to setup, it just looks a lot because there's ample helpful explanation around the steps.

You might also find git commit --amend and git push --force useful when you're updating a PR with small fixes.

@jodal jodal closed this Apr 15, 2018
@jodal jodal changed the base branch from develop to master April 15, 2018 20:06
@jodal jodal reopened this Apr 15, 2018
@jjok
Copy link
Contributor

jjok commented Mar 11, 2020

This PR is no longer needed as the issue has been fixed by #233.

@jodal jodal closed this Mar 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants