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

Grouping count command enhancement #52

Closed
wants to merge 3 commits into from
Closed

Grouping count command enhancement #52

wants to merge 3 commits into from

Conversation

mxjeff
Copy link
Collaborator

@mxjeff mxjeff commented Feb 23, 2015

Should close #50

@multani
Copy link
Collaborator

multani commented Feb 23, 2015

I had a really quick look at this, and the change looks interesting to add in.
However, that's technically speaking a incompatibility change since the result of the count command is different. There should be a document to update in the doc/ directory to explain the change, can you update it? We should also do something about the version number when releasing this, I guess.

Additionally, there're some unit tests in the repository, that would be awesome if you could turn your example into tests!

I can give a more proper look someday next week, if someone else doesn't take this over :)

@mxjeff
Copy link
Collaborator Author

mxjeff commented Feb 23, 2015

Alright I'll try to take time to complete and rework the pull request :-)

@mxjeff mxjeff closed this Feb 23, 2015
@multani
Copy link
Collaborator

multani commented Feb 23, 2015

You could have let this pull request opened and just update your branch as needed, my comment wasn't meant for you to close this and start all over again :) Sorry if you took it this way, that wasn't my intention.

(FYI, doing so allows to keep track of the comments, the modifications, and see what's being worked on.)

On February 23, 2015 11:54:04 PM GMT+08:00, kaliko [email protected] wrote:

Closed #52.


Reply to this email directly or view it on GitHub:
#52 (comment)

@mxjeff
Copy link
Collaborator Author

mxjeff commented Feb 23, 2015

Humm, sorry. I'm not really used to github process.

I'll reopen the PR, it makes sense indeed to work on this thread of comment.

Thanks for the heads up :-)

@mxjeff mxjeff reopened this Feb 23, 2015
@mxjeff
Copy link
Collaborator Author

mxjeff commented Feb 23, 2015

I've added the relevant unit test.

I'm not that confident with documentation, I'de rather leave editing to somebody else with better english/reST/sphinx skills.

Changes are rather simple from the API point of view (though the output format changes). Comments on #50 and example provided in the pull request are self explanatory I think.

@mxjeff
Copy link
Collaborator Author

mxjeff commented Feb 26, 2015

I've just noticed grouping is available for list command as well (cf. #53).

I believe a better solution can solve both issues, this pull request might be obsolete then.

I'll try to come up with a better solution for count and list.

@mxjeff
Copy link
Collaborator Author

mxjeff commented Feb 26, 2015

I believe a way to go would be to expose command's argument in fetch_ methods (retval in _execute method).

It means changing signatures for all _fetch_* methods but it would ease a lot for these cases where MPD answer's format in conditioned by commands arguments.

That's just an idea, I haven't been through all the code and I might have missed some side effects.

@Mic92
Copy link
Owner

Mic92 commented Feb 26, 2015

Replacing the group argument with a keyword argument looks cleaner to me.

cli.count(group='date') 

@Mic92
Copy link
Owner

Mic92 commented Feb 26, 2015

The function signatures could look like this:

 def count(self, tag, needle, group=None):
     pass

 def list(self, _type, *args, group=None):
     pass

@Mic92
Copy link
Owner

Mic92 commented Feb 26, 2015

This has also the advantage, that the group key is known, we do not have to maintain a list of possible group keys.

@mxjeff
Copy link
Collaborator Author

mxjeff commented Mar 18, 2015

You mean not going through the mpd._commands abstraction and define explicit methods count/list in MPDClient object? As it's done for noidle for ex.?

I tried to avoid that kind of solutions as it breaks the current design of the module, but I might be wrong, I'm far from a software architect :D

@Mic92
Copy link
Owner

Mic92 commented Mar 18, 2015

If mpd adds more keyword style arguments, it might be worth to extend the current metaprogramming done with mpd._commands. But currently I think it is easier to just add the methods manually, because the response type changes depending on the arguments, which the current system was not built for.

@Mic92
Copy link
Owner

Mic92 commented Nov 21, 2018

closed through lack of activity.

@Mic92 Mic92 closed this Nov 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grouping count command
3 participants