-
Notifications
You must be signed in to change notification settings - Fork 26
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
Refactor socos to add an interactive shell #5
Conversation
|
||
|
||
def play(sonos, idx): | ||
if args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably be idx instead of args
I've tested the various functions both in 'shell' and 'interactive', found some bugs that I've commented, but I generally like the idea!! I do however have one other input after reading the code, should some of the functions be moved to a ( or multiple ) separate class(es). That way we could start looking into unit-testing some of this code, and it should theoretically end up a bit cleaner. |
Thanks for your input! I think I've addressed all comments so far.
I agree that the file is quite big already, and a bit refactoring won't hurt... Do you have any suggestions on what exactly to move? |
I think we can split this in a step by step process, start by adding a Player class and move all the 'commands' to it, so the current socos.py ends up as a form of runner for this class ( for now socos.py can still take care of input, cli vs interactive etc ). Next step might be to move everything related to volume to a separate Volume class that is then used in the Player as we have multiple volume related functions. Further down the road we can split between 'state changing' type of functions like play,stop,next etc and information returning functions like print_queue, print_current_track_info, but I would postpone this until we see a need for it. |
+1 Great work. Couple of minor additions that would be nice (but no reason not to pull this):
Cheers David |
+1 for merge in a couple of days. |
+1 looks good |
Refactor socos to add an interactive shell
Thanks everyone! I'll work on additional features / refactoring soon. |
except for #9 everything else seems to be working nicely after the merge :) |
I've more or less completely refactored
socos.py
in order to add an interactive shell.You can now do something like the following (comments added manually)
The shell supports readline features such as arrow-navigation, Ctrl+R search, etc.
All other features should have been preserved. Error handling should still be improved, though. Tab-completion is also still missing.
Please let me know what you think.
-- Stefan