Commit Graph

3309 Commits

Author SHA1 Message Date
Thomas Adamcik
1dc35c2bf7 mpd: Convert channels and stickers and delete empty. 2014-01-23 21:41:06 +01:00
Thomas Adamcik
fddb299ed9 mpd: Update type converters naming and add UINT
Also adds tests for RANGE helper.
2014-01-23 21:31:18 +01:00
Thomas Adamcik
442d9d4b1e mpd: Convert almost all of protocol.current_playlist 2014-01-23 00:40:46 +01:00
Thomas Adamcik
e7017f3ccb mpd: Add protocol.position_or_range converter 2014-01-23 00:40:18 +01:00
Thomas Adamcik
b9b5a78938 mpd: Convert protocol.playback 2014-01-22 23:58:44 +01:00
Thomas Adamcik
538e46e0e7 mpd: Convert protocol.status to new helper 2014-01-22 23:27:49 +01:00
Thomas Adamcik
9df2eebfe2 mpd: Upate command reflection to handle new commands helper 2014-01-22 23:27:49 +01:00
Thomas Adamcik
55a46c31d7 mpd: Cleanup imports in reflection 2014-01-22 23:27:49 +01:00
Thomas Adamcik
eb85f92d96 mpd: Store auth required and if command should be listed 2014-01-22 23:27:25 +01:00
Thomas Adamcik
d3db5c4fe1 mpd: Install new commands helpers in _call_handler
This means we now tokenize every request, and then try in call the appropriate
handler. If none is found we simply fall back to the old handlers.
2014-01-22 22:44:40 +01:00
Thomas Adamcik
066fed1522 mpd: Update tokenizer to use mopidy.mpd.exceptions 2014-01-22 00:10:30 +01:00
Thomas Adamcik
756cf1518b mpd: Add last missing error cases for tokenizer.
If we decide that exact error message parity is not needed these can and should
be removed as they complicate the tokenizer.
2014-01-21 23:20:24 +01:00
Thomas Adamcik
f7ec1fba01 mpd: Fix tokenizer error messages to match original protocol 2014-01-21 22:10:00 +01:00
Thomas Adamcik
d445740318 mpd: Split out tokenizer and add proper errors. 2014-01-21 21:10:55 +01:00
Thomas Adamcik
335cf4e612 mpd: Return command name in find handler. 2014-01-21 20:40:49 +01:00
Thomas Adamcik
455f3dd403 mpd: Write commands helper for tokenized command handling
This provides a class which works as a command registry. Functions are added to
the registry through a method on the class `add`.  Add acts as a decorator
taking in the name of the command and optionally type converters for arguments.

When handling requests, we can now tokenize the line, and then just pass the
arguments to our commands helper. It will lookup the correct handler and apply
any validation before calling the original function.

For the sake of testing the original function is not wrapped. This the
functions, and anything testing them directly can simply assume pre-converted
data as long as type annotations are in place.

A sample usage would be:

    @protocol.commands.add('addid', position=protocol.integer)
    def addid(context, uri, position=None)
        pass

    def handle_request(line):
        tokens = protocol.tokenizer(line)
        context = ...
        result = protocol.commands.call(tokens, context=context)
2014-01-19 19:59:07 +01:00
Thomas Adamcik
b34a8c1f73 mpd: Add MPD tokenizer
- Adds tests for correctness of tokenizer (which also would have shown shlex
  wouldn't have worked).
- Should conform with the original's behavior, though we won't be able to match
  the error messages without a lot of extra work as a non-regexp version is
  likely a no go on python due to speed.
2014-01-19 13:47:09 +01:00
Stein Magnus Jodal
4026e16996 Merge pull request #653 from adamcik/feature/local-browse-speedup
Feature/local browse speedup
2014-01-18 13:25:30 -08:00
Thomas Adamcik
1ebe7f612a local: Build browse cache backwards to reduce work needed 2014-01-18 12:26:21 +01:00
Thomas Adamcik
2faae3fc05 local: Add debug timing to loading library and building browse cache 2014-01-18 12:25:09 +01:00
Stein Magnus Jodal
e4869e9e34 backend: Make old DummyBackend imports work 2014-01-18 02:12:04 +01:00
Stein Magnus Jodal
1ea0978af5 dummy: Move dummy backend back into the mopidy package 2014-01-18 01:38:10 +01:00
Thomas Adamcik
316a1bf20f local: Ensure logging does not divide by zero in scanner. 2014-01-18 01:31:44 +01:00
Stein Magnus Jodal
b11338b1ab Bump version to 0.18.0 2014-01-18 01:02:36 +01:00
Stein Magnus Jodal
d447cbd798 core: Fix typo 2014-01-18 00:59:15 +01:00
Stein Magnus Jodal
da71d7fb14 Merge pull request #647 from adamcik/feature/browse-by-uri
Convert browse API to be fully URI based.
2014-01-17 15:58:39 -08:00
Stein Magnus Jodal
31abe0bc93 mpd: Annotate exceptions with current command automatically (fixes #649) 2014-01-18 00:34:41 +01:00
Thomas Adamcik
52e66add97 review: Update browse docstring with respect to URI type 2014-01-18 00:16:53 +01:00
Thomas Adamcik
08b7d199f7 review: Typos and code formating 2014-01-17 23:52:18 +01:00
Stein Magnus Jodal
06856851f7 local: Make search filters more robust (fixes #635) 2014-01-17 23:43:43 +01:00
Thomas Adamcik
43e16ddb65 mpd: Switch mpd to use path<->uri mapping for browsing 2014-01-17 17:16:24 +01:00
Thomas Adamcik
d6aa9fb013 local: Convert local browsing to uri based system. 2014-01-17 17:16:24 +01:00
Thomas Adamcik
999f478010 core: Update browse to use uri isntead of path 2014-01-17 17:16:24 +01:00
Thomas Adamcik
826419d829 backend/core: Switch to root_directory instead of name 2014-01-16 22:53:18 +01:00
Stein Magnus Jodal
ba87613fd1 local: Replace invalid UTF-8 data from library 2014-01-16 21:09:00 +01:00
Stein Magnus Jodal
300c5d2e64 Merge pull request #644 from adamcik/feature/scanner-tag-handling
Cleanup taglist handling and translation to tracks.
2014-01-15 15:10:26 -08:00
Thomas Adamcik
c5be900ab4 audio: Review fixes 2014-01-15 23:53:17 +01:00
Stein Magnus Jodal
06719d0e66 Bump version to 0.18.0a1 for easier testing of updated extensions 2014-01-15 23:51:28 +01:00
Thomas Adamcik
2dc8282b25 audio: Cleanup translator code.
This code was trying to be to smart for it's own good. This commit greatly
reduces the magic and leaves us with much more straight forward code.
2014-01-15 22:20:36 +01:00
Thomas Adamcik
81b920a9e4 model: Update to handle None in sets.
Also adds some missing tests for composers and performers.
2014-01-15 22:20:36 +01:00
Thomas Adamcik
3e9cd0c4b7 audio: Add tests for all fields that can be converted 2014-01-15 22:20:36 +01:00
Thomas Adamcik
b0b5d4972f models: Make .copy(foo=None) null out field. 2014-01-15 22:20:36 +01:00
Thomas Adamcik
807bedad85 audio: Change audio data convert to operate on taglists 2014-01-15 22:20:36 +01:00
Thomas Adamcik
7209b38aa6 audio: Nest tags in scan data return value 2014-01-15 22:20:36 +01:00
Stein Magnus Jodal
d698653d83 mpd: Implement "listallinfo" command (fixes #145) 2014-01-15 01:11:27 +01:00
Stein Magnus Jodal
afbff12ccc mpd: Implement "listall" command 2014-01-15 00:52:01 +01:00
Stein Magnus Jodal
ead48f61cb Merge pull request #641 from jodal/feature/consistent-playback-events
Make core playback events consistent
2014-01-14 14:55:21 -08:00
Stein Magnus Jodal
c6cff2794c Merge pull request #640 from adamcik/feature/local-browse
Add local browsing
2014-01-14 14:43:31 -08:00
Thomas Adamcik
03838a1968 mpd: Add tests for adding VFS folders 2014-01-14 23:29:52 +01:00
Thomas Adamcik
a8458720ee local: Review fixes 2014-01-14 22:07:20 +01:00