Commit Graph

142 Commits

Author SHA1 Message Date
Stein Magnus Jodal
5583ca5aba New flake8 version with new checks to conform to 2014-03-29 20:47:42 +01:00
Thomas Adamcik
8756c2bff5 review: Type fixing 2014-02-16 23:17:46 +01:00
Thomas Adamcik
2e6f716b72 Merge branch 'develop' into feature/mpd-tokenized-requests
Conflicts:
	mopidy/mpd/protocol/stored_playlists.py
2014-01-30 22:48:28 +01:00
Stein Magnus Jodal
38d3c6ccf9 models: Make Playlist.last_modified milliseconds since Unix epoch 2014-01-28 23:57:02 +01:00
Thomas Adamcik
f24ca36e5a mpd: Switch browse commands to common helper 2014-01-25 00:42:32 +01:00
Thomas Adamcik
e304b7fc2b mpd: Use mopidy.mpd.exceptions in commands 2014-01-24 01:12:26 +01:00
Thomas Adamcik
86f5602023 mpd: Remove old command handlers 2014-01-24 00:35:10 +01:00
Thomas Adamcik
dc8d311bc3 mpd: Complete music db conversion with list 2014-01-24 00:23:05 +01:00
Thomas Adamcik
68aa0b556c mpd: Convert search functions in music db 2014-01-23 23:58:42 +01:00
Thomas Adamcik
8f8bed5b87 mpd: Implement playlistinfo from current playlist 2014-01-23 23:12:25 +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
eb85f92d96 mpd: Store auth required and if command should be listed 2014-01-22 23:27:25 +01:00
nathanharper
039fc4b681 refactored mpd.protocol.music_db regex
got quote backreference working,
eliminated need for the non-capturing pattern,
fixed problem with quoted fields.
2014-01-22 05:16:38 -05: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
f7aff706a8 mpd: Move commands tests to mpd directory 2014-01-21 21:14:30 +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
1ea0978af5 dummy: Move dummy backend back into the mopidy package 2014-01-18 01:38:10 +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
43e16ddb65 mpd: Switch mpd to use path<->uri mapping for browsing 2014-01-17 17:16:24 +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
c781f77ef3 Rename test files to pattern expected by test runners 2014-01-15 00:01:50 +01:00
Thomas Adamcik
03838a1968 mpd: Add tests for adding VFS folders 2014-01-14 23:29:52 +01:00
Stein Magnus Jodal
d724001f5b tests: Move mopidy.backends.dummy to tests.dummy_backend 2014-01-11 15:49:22 +01:00
Stein Magnus Jodal
fe28311324 models: Use new Ref constructors 2014-01-09 08:54:33 +01:00
Stein Magnus Jodal
1fd1a38013 Merge branch 'develop' into feature/library-browse
Conflicts:
	mopidy/backends/local/json/library.py
	mopidy/core/actor.py
	tests/backends/local/library_test.py
2014-01-09 08:39:38 +01:00
Thomas Adamcik
96eb9a87c6 mpd: Whitespace fix to make travis happy. 2014-01-09 00:41:46 +01:00
kingosticks
f2a26ef246 Fixed line length for flake 2014-01-08 23:04:38 +00:00
kingosticks
0d74be0b1e Empty MPD commands should return an error instead of OK, just like the original MPD server. Includes tests. 2014-01-06 12:33:20 +00:00
Stein Magnus Jodal
af3b0e40fd models: Add Ref.type constants 2014-01-03 22:19:54 +01:00
Stein Magnus Jodal
7dba0dafa5 mpd: Include dirs and files in lsinfo response 2014-01-02 22:06:33 +01:00
Stein Magnus Jodal
1ee534126e mpd: Move mopidy.{frontends => }.mpd 2013-12-31 14:11:16 +01:00
Stein Magnus Jodal
b4c91af7d7 Relocate MPD frontend to 'mopidy.frontends.mpd' 2010-08-09 21:17:36 +02:00
Stein Magnus Jodal
3339fb7de0 Fix 'play/playid "-1"' behaviour when playlist is empty 2010-08-09 20:44:01 +02:00
Stein Magnus Jodal
d2aa7c9d21 Fix formatting 2010-08-09 12:20:59 +02:00
Stein Magnus Jodal
8c1e5d5c69 Remove Track.id usage in MPD tests 2010-08-08 17:14:07 +02:00
Stein Magnus Jodal
c83ac35758 MPD: Add more docs and tests to 'playlistsearch' 2010-08-03 09:07:33 +02:00
Stein Magnus Jodal
999de87d07 MPD: Use CPID in 'plchangesposid' output 2010-08-02 23:02:51 +02:00
Stein Magnus Jodal
44309345db Update 'addid' to return CPID instead of GID 2010-08-02 14:27:57 +02:00
Stein Magnus Jodal
04304dafd8 tests: Split mpd/frontend_test into 11 files 2010-07-31 20:19:24 +02:00
Stein Magnus Jodal
64544a0b71 Use cp_track in CurrentPlaylistCtl and PlaybackCtl
A new data structure called ``cp_track`` is now used in the current
playlist controller and the playback controller. A ``cp_track`` is a
two-tuple of (CPID integer, mopidy.models.Track), identifying an
instance of a track uniquely within the current playlist.

This fixes issues with using playlists with multiple instances of the
same track.
2010-07-31 19:51:03 +02:00
Stein Magnus Jodal
affd1799d6 Use CPID in MPD formats.
This makes it possible to handle multiple identical songs in the same
playlist.
2010-07-01 03:15:43 +02:00
Stein Magnus Jodal
d65c76c528 Merge branch 'master' into cpc 2010-07-01 01:03:35 +02:00
Stein Magnus Jodal
dd494107d3 Extract mpd_format from models to mopidy.mpd.serializers 2010-07-01 00:39:50 +02:00