Commit Graph

4687 Commits

Author SHA1 Message Date
Thomas Adamcik
63899059be main: Convert main program flow to command helpers
- Moves all startup code from start() into mopidy.commands
- Moves deps and config to mopidy.commands
- Plugs in use of commands parsing provided by new helpers
- Allows commands to override base verbosity level
- Removes defunct bootstrap logging helper.
2013-11-14 23:33:29 +01:00
Thomas Adamcik
a6c3b78a6f local: Convert local scanning to new commands.
Also moves mopidy.backends.local.scan to .command
2013-11-14 23:32:55 +01:00
Thomas Adamcik
da4cfebe05 ext: Add get_command and mopidy.backends.base.Command 2013-11-14 23:31:20 +01:00
Thomas Adamcik
c0f1a1352b commands: Replace set_defaults with set method
For our use case we only need to be able to override a value, not set defaults
so this simplifies everything.
2013-11-14 23:31:20 +01:00
Thomas Adamcik
39f7fd5955 commands: Extend use of exit helper to parser errors
This moves all the bad arugment handling into our class and makes sure to mark
all the helpers as internal.
2013-11-14 23:31:20 +01:00
Thomas Adamcik
d82f48a42f commands: Internalise handling of help action
This means help will always be handled by the root command. Additionally this
adds an exit helper.
2013-11-14 23:31:20 +01:00
Thomas Adamcik
0b1b249ae8 commands: Remove trailing newline for command errors 2013-11-14 23:31:20 +01:00
Thomas Adamcik
1394f3929b commands: Add run method to Commands 2013-11-14 23:31:20 +01:00
Thomas Adamcik
f5a5f9e9b1 commands: Add str method CommandError 2013-11-14 23:31:20 +01:00
Thomas Adamcik
b5360a1360 commands: Add usage to CommandError 2013-11-14 23:31:20 +01:00
Thomas Adamcik
001c8e0bdc commands: Add set_defaults() to the parser
- Removes mock based test that checks delegation, just check commands result
- Allow setting of defaults that propegate down the chain
- Move internal parser args to a _parse helper.
2013-11-14 23:31:20 +01:00
Thomas Adamcik
6bddcb7875 commands: Add help_formatter() with tests. 2013-11-14 23:31:20 +01:00
Thomas Adamcik
88bc046605 commands: Make sure parser errors get translated to correct error type. 2013-11-14 23:31:20 +01:00
Thomas Adamcik
fa7eee3bdf commands: Add basic format usage helper 2013-11-14 23:31:20 +01:00
Thomas Adamcik
754865d8b6 commands: Set child names upon adding them 2013-11-14 23:31:20 +01:00
Thomas Adamcik
7c82485a07 commands: Start adding commands util helper.
This class is intended to be used to contruct a tree of sub-commands. In this
intial version it mainly focuses on exposing `add_argument` to allow for nested
parsers. Next step is to start adding better `--help` that shows the entire tree
and hooking it up to select what code path to really run.
2013-11-14 23:31:20 +01:00
Thomas Adamcik
851cf65328 docs: More review fixes 2013-11-10 13:11:01 +01:00
Thomas Adamcik
d839a0d1ba local: Fix flake mistakes in scan sub-command. 2013-11-10 13:03:53 +01:00
Thomas Adamcik
4e6ebbe955 local/docs: Update based on review comments
- Bunch of typos and wording improvements from review.
- Fixed mopidy.backends.local.scan botched merge.
- Document and enforce that sub-command name needs to be bytes.
2013-11-09 18:20:22 +01:00
Thomas Adamcik
df953ea1e6 Merge branch 'develop' into feature/subcommands
Conflicts:
	mopidy/scanner.py
2013-11-09 13:40:47 +01:00
Thomas Adamcik
5cd0938e0d docs: Update changelog with sub-commands work 2013-11-09 13:38:09 +01:00
Thomas Adamcik
3945e437de docs: Fix minor doc issues found during review
- Adds autodoc for mopidy.audio.scan
- Updates ``file://`` to ``local:``
- Minor language fix.
2013-11-09 13:30:27 +01:00
Thomas Adamcik
67c028c31e docs: Update docs with respect to sub-commands 2013-11-09 13:23:52 +01:00
Thomas Adamcik
51d1e22655 docs: Update changelog for PR #566 and #567 2013-11-08 23:51:45 +01:00
Thomas Adamcik
1a3ff456f9 scanner: Remove old scanner in favour of sub-commands 2013-11-08 23:21:26 +01:00
Thomas Adamcik
b5f8480eea local: Add 'mopidy scan' command via extension sub-commands. 2013-11-08 23:20:19 +01:00
Thomas Adamcik
2581062ae0 ext/backends: Add extensions to sub commands run 2013-11-08 23:18:26 +01:00
Thomas Adamcik
ef10c2e178 main: Wire in actual execution of sub-commands. 2013-11-08 22:04:26 +01:00
Thomas Adamcik
518cac5eab ext/backends: Add get_sub_commands and BaseSubCommandProvider 2013-11-08 22:01:18 +01:00
Thomas Adamcik
7144876dc5 main: Move default subparsers into commands module
Also switches to using dest for storing the chosen sub-parser.
2013-11-08 22:01:18 +01:00
Thomas Adamcik
25fedc7700 loggin: Add DelayedHandler to root logger.
The delayed handler:
- Accepts and buffers logs until they are released.
- Upon release the logs are re-posted to the root logger.
- After release log records are ignored.

This allows us to avoid the silly tricks we've been doing with parsing args and
config early for the sake of bootstraping logging. Now we can just start
logging and once the logging has been setup the messages are released and
handled according to the correct settings.
2013-11-08 19:53:00 +01:00
Thomas Adamcik
4f03677675 main: Improve main bootstrapping sequence
- Parses args in two pases to allow for setup of logging well before doing
  extension sub-commands.
2013-11-08 19:53:00 +01:00
Thomas Adamcik
9539c2ac35 main: Switch to subcommands
- show-deps replaced with 'mopidy deps'
- show-config replaced with 'mopidy config'
- Just running mopidy now displays help, run 'mopidy run' to start server.
2013-11-08 19:53:00 +01:00
Thomas Adamcik
f49973304c main: Start unifying command handling
- Removes show_deps and show_config from commands module. These
  are now handled directly in the main() method pending subcommands.
- Unifies show_config with general main() config handling.
- Sets default verbosity level to zero.
- Reduce verbosity when --show-config or --show-deps is called.
- Update console logging to consider verbosity < 0 quiet/
2013-11-08 01:17:52 +01:00
Thomas Adamcik
51b778fcd6 main: Create helper for logging boostraping 2013-11-08 00:59:05 +01:00
Thomas Adamcik
bdba83b1be main: Move argparse building to a function. 2013-11-08 00:09:17 +01:00
Stein Magnus Jodal
e608f9f213 Merge pull request #567 from adamcik/feature/local-uri-translation
local/scanner: Make checking mtime and skipping known files work again
2013-11-07 15:00:17 -08:00
Thomas Adamcik
93918cb1e0 local: flake8 fixes 2013-11-07 23:25:55 +01:00
Stein Magnus Jodal
5b78ff94ff docs: Remove count from MPD limitations list 2013-11-07 19:33:46 +01:00
Thomas Adamcik
e7dd7e2677 local/scanner: Make checking mtime and skipping known files work again
This change just patches over the worst of the inconsistencies in how the
scanner mixes local and file uris to get us to a working state again. Ideally,
this still needs a real cleanup when we finish the plugable library providers
and/or json library work.
2013-11-07 00:03:00 +01:00
Thomas Adamcik
f8dedc0b84 local: Add local_to_file_uri translator 2013-11-06 21:46:41 +01:00
Stein Magnus Jodal
71eff1bf45 Merge pull request #566 from adamcik/feature/scanner
Switch back to custom scanner
2013-11-06 12:31:02 -08:00
Thomas Adamcik
86926e8011 scanner: Remove unused argument for progress helper. 2013-11-06 21:14:11 +01:00
Thomas Adamcik
dc3cf427b6 scanner/mpd: Add TODOs for later and fix flake8 warning 2013-11-06 19:19:17 +01:00
Thomas Adamcik
e6381a1a0a audio: Add mtime to scanner results for file: uris 2013-11-06 19:10:49 +01:00
Thomas Adamcik
469f414c4c audio: Don't do duration conversion to ms in scanner 2013-11-06 19:10:49 +01:00
Thomas Adamcik
16ac5277f6 audio: Make min duration in scanner configurable. 2013-11-06 19:10:49 +01:00
Thomas Adamcik
20b0602842 audio/scanner: Move translator into audio.
Tries to move more of the gst bits and pieces we are leaking into audio.
2013-11-06 19:10:49 +01:00
Thomas Adamcik
4cadba0ac7 scanner: Add progress tracking and process sorted uris 2013-11-06 19:10:49 +01:00
Thomas Adamcik
0a2d74eff1 scanner: Update to use new mopidy.audio.scan
Also adds the check less than 100ms check back to the scanner.
2013-11-06 19:10:49 +01:00