Commit Graph

254 Commits

Author SHA1 Message Date
Stein Magnus Jodal
f58fe9a192 py3: Replace xrange() with range() 2014-09-17 20:28:07 +02:00
Stein Magnus Jodal
a244761abc mpd: Replace / with | instead of whitespace in playlist names 2014-08-17 23:25:09 +02:00
Trygve Aaberge
9771eda230 mpd: Test that "list album foo" responds correctly
Previously, test_list_album_with_artist_name would only test that the
command didn't fail. Now it also checks that the response is correct.
That is, that the response contains albums.

This makes the test detect the error reported in #817.
2014-08-05 18:34:08 +02:00
Stein Magnus Jodal
93bf3ea918 mpd: Fix crash on wrong number of command args
Fixes #789
2014-07-26 13:56:26 +02:00
Trygve Aaberge
c062dd21c4 mpd: Create unique names for all items in browse
Replace the playlist uri/name mapping with a mapping for all the items
in browse. Check the mapping when browsing a path.

This has the added benefit of serving as a cache for browse, so we don't
need to traverse the path parts and lookup each of them for each call to
browse.
2014-06-24 00:45:49 +02:00
Stein Magnus Jodal
9b9791ab5b Merge pull request #755 from trygveaa/feature/lsinfo-change-order
mpd: List browse results before playlists in lsinfo
2014-06-22 09:49:00 +02:00
Trygve Aaberge
1ac470c58c mpd: Test that whitespace query parts are ignored 2014-06-22 02:13:14 +02:00
Trygve Aaberge
0c3e5bd71e mpd: Test that empty query parts are ignored 2014-06-21 17:29:41 +02:00
Trygve Aaberge
81898cb709 mpd: Test order of result from lsinfo 2014-06-21 14:42:35 +02:00
Trygve Aaberge
0b7243dce1 mpd: Test albums in listall(info) 2014-06-21 01:52:44 +02:00
Trygve Aaberge
496b3f5552 mpd: Test playlists in listall(info) 2014-06-20 22:16:27 +02:00
Stein Magnus Jodal
b754885064 Fix all import order warnings 2014-05-07 20:08:43 +02:00
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
Stein Magnus Jodal
6005086a7f Merge remote branch 'klette/master' 2010-06-30 23:42:15 +02:00
Stein Magnus Jodal
5916646eca Format IP address to bind to according to available protocol family 2010-06-30 21:50:49 +02:00
Kristian Klette
699385b613 Support list album artist "someartist" 2010-06-30 20:40:20 +02:00
Kristian
7922795d2f Return OK on noidle 2010-06-30 20:08:53 +02:00
Stein Magnus Jodal
81503df2ad Merge branch 'master' into cpc 2010-06-30 12:45:01 +02:00
Stein Magnus Jodal
b3bff400e6 MPD: Accept list without quotes around field arg 2010-06-30 12:44:46 +02:00
Stein Magnus Jodal
1e0a5e5bb3 CurrentPlaylistController.load() reuse add() logic 2010-06-30 00:31:49 +02:00
Stein Magnus Jodal
93b606af3e Fix tests broken by the two previous cherry-picked commits 2010-06-30 00:23:28 +02:00
Stein Magnus Jodal
4ba30f80e4 CurrentPlaylistController.load() takes a list of tracks instead of a Playlist object 2010-06-29 23:53:52 +02:00
Stein Magnus Jodal
4e29754ce6 Remove 'ack' command added by Mopidy 2010-06-24 20:00:58 +02:00
Stein Magnus Jodal
1aa5963697 MPD: Add correct index to error message when error happens while processing a command list 2010-06-24 19:59:21 +02:00
Stein Magnus Jodal
95f83c8102 Rename MpdAckError.position to MAE.index 2010-06-24 19:57:06 +02:00
Stein Magnus Jodal
d093e498d8 'command_list_end' before 'command_list_start' now returns 'unknown command' error instead of crashing 2010-06-24 19:47:44 +02:00
Stein Magnus Jodal
a8672eb87b MPD: Remove some commands from the 'commands' output, as MPD does not list them and GMPC fails if 'idle' is present in the list 2010-06-24 12:55:49 +02:00
Stein Magnus Jodal
bcc133a079 MPD: More correct date format in listplaylists output 2010-06-24 12:50:59 +02:00
Stein Magnus Jodal
2f9775250a Return 'incorrect arguments' instead of 'unknown command' for known commands that don't match any patterns 2010-06-23 22:53:27 +02:00
Stein Magnus Jodal
af30db91e1 Update all MpdAckErrors thrown by request handlers. Three tests intentionally left failing. 2010-06-23 22:23:42 +02:00
Stein Magnus Jodal
a234d41d77 MPD-compliant ACK error messages
Started work on MPD-compliant ACK error messages. 14 tests are
intentionally left broken.
2010-06-22 23:52:35 +02:00
Stein Magnus Jodal
11b8ab89c9 Fix support for IPv4 addresses in SERVER_HOSTNAME which was broken by new IPv6 support 2010-06-20 23:00:52 +02:00
Stein Magnus Jodal
3c3d2728ad MPD: Don't crash when receiving invalid data 2010-06-20 21:51:15 +02:00
Stein Magnus Jodal
d00c47ec88 MPD: Implement 'commands' command 2010-06-20 21:25:46 +02:00
Stein Magnus Jodal
a9923fcb23 Merge remote branch 'adamcik/gstreamer'
Conflicts:
	mopidy/mpd/frontend.py
	tests/mpd/frontend_test.py

GstreamerBackend now raises LookupError where the other backends just
returns None. We'll probably move in the direction of using LookupError
all over, but the changes to DummyBackend and generic tests was reverted
until BaseBackend, the backend API docs and the other backends are
updated to all raise LookupError.
2010-06-06 22:15:25 +02:00
Stein Magnus Jodal
d135066b0d addid should ACK, and not crash or be silent on error conditions 2010-06-06 22:04:50 +02:00
Thomas Adamcik
e0ffd7e7a1 Add test_add_uri_that_triggers_lookup_error 2010-05-06 00:11:23 +02:00
Thomas Adamcik
c8b3c91c7c Test that playlistinfo -1 == playlistinfo and add FIXMEs for rest of playlistinfo tests 2010-05-05 23:55:28 +02:00
Stein Magnus Jodal
c8b6e4728d MPD: Handle 'play "-1"' in same way as 'playid "-1"' 2010-05-05 14:37:58 +02:00
Stein Magnus Jodal
b408751520 MPD: Handle 'lsinfo ""' in the same way as 'lsinfo' and 'lsinfo "/"' 2010-05-05 12:54:49 +02:00
Stein Magnus Jodal
5638604a07 Remove backend.playback.volume in preference of backend.mixer.volume 2010-05-03 22:38:21 +02:00
Stein Magnus Jodal
eac8015970 Use assertEqual without 's' all over 2010-05-01 14:47:41 +02:00
Stein Magnus Jodal
cf1fbda387 Fix more pylint violations 2010-05-01 11:46:59 +02:00
Thomas Adamcik
619ce7230d Move load appends test to frontend where it belongs 2010-04-09 08:36:09 +02:00
Thomas Adamcik
9c8cab684c Move SkipTests to tests.SkipTest 2010-04-09 08:35:45 +02:00
Stein Magnus Jodal
332d917b53 Update frontend to match CPC.get() changes 2010-03-31 23:44:17 +02:00
Stein Magnus Jodal
34ebdaf8de Update frontend to use new SPLC.get() 2010-03-31 23:30:27 +02:00
Stein Magnus Jodal
7039031161 Update frontend to use new BaseCurrentPlaylistController.get() 2010-03-31 20:49:58 +02:00
Johannes Knutsen
5a9b141657 set current_track to None on clear commands - required by Sonata 2010-03-30 02:34:58 +02:00
Johannes Knutsen
818e602221 handle gmpc issuing playid "-1" after playlst replacement 2010-03-30 01:59:34 +02:00
Johannes Knutsen
ecfd774e64 test find album "what" artist "what" command 2010-03-30 01:29:07 +02:00
Stein Magnus Jodal
bcd9fd66e8 Use index to get KeyError message instead of unicode() as its behaviour varies between Solaris/Py2.6.5 and Ubuntu/Py2.6.4 2010-03-29 20:56:29 +02:00
Stein Magnus Jodal
61dadc02b6 Add MopidyException base exception 2010-03-29 20:55:33 +02:00
Stein Magnus Jodal
1498c2cbba Try to fix exception message handling on Solaris and/or Python 2.6.5 2010-03-29 20:29:07 +02:00
Stein Magnus Jodal
fdf3d4f11b Replace CoverageTestRunner with nosetests 2010-03-23 23:54:49 +01:00
Stein Magnus Jodal
bf05602318 Add support for 'playlistfind filename ...' 2010-03-22 22:09:00 +01:00
Stein Magnus Jodal
432d70ff51 Remove unused imports 2010-03-20 16:50:18 +01:00
Stein Magnus Jodal
4c58d3b773 Fix tests 2010-03-20 02:49:10 +01:00
Stein Magnus Jodal
6a2e7e2e73 Add support for negative songpos arg in 'playlistinfo' as used by ncmpc 2010-03-14 23:18:03 +01:00
Stein Magnus Jodal
1729d9e962 Use 2^31 - 1 instead of 2^31 to keep inside 32-bit integer (good I'm varying what platforms I work at) 2010-03-13 00:37:34 +01:00
Stein Magnus Jodal
38399c844b Update tests to check for 'OK' from 'idle' calls 2010-03-09 00:16:20 +01:00
Stein Magnus Jodal
38992bcf9c Move MPD exceptions into mopidy.mpd 2010-03-08 20:37:03 +01:00
Stein Magnus Jodal
523216d0fd Add mixer API and rewrite ALSA mixer hack 2010-03-07 23:48:50 +01:00
Stein Magnus Jodal
7838d7ceb5 Fix 'urlhandlers' output 2010-03-07 21:11:34 +01:00
Stein Magnus Jodal
290f3adc14 Add tests for 'find' and 'search' without quotes 2010-03-07 19:52:47 +01:00
Stein Magnus Jodal
bc1167ba06 Return 'positive' but empty results on 'count' and 'list' 2010-03-07 19:27:13 +01:00
Stein Magnus Jodal
04ceb83c94 Implement _playback_single and add 'single' field to BasePlaybackController 2010-02-28 23:22:12 +01:00
Stein Magnus Jodal
2d2e7c2488 Implement _playback_repeat 2010-02-28 23:18:35 +01:00
Stein Magnus Jodal
ede1b7d5ab Implement _playback_random 2010-02-28 23:17:45 +01:00
Stein Magnus Jodal
68810d01b7 Implement _playback_consume 2010-02-28 23:16:06 +01:00
Stein Magnus Jodal
d0916334d4 Implement _current_playlist_swapid 2010-02-28 23:10:54 +01:00
Stein Magnus Jodal
b89a6fc46d Implement _current_playlist_swap 2010-02-28 23:07:44 +01:00
Stein Magnus Jodal
c8ee771ebc Implement _current_playlist_shuffle 2010-02-28 22:56:42 +01:00
Stein Magnus Jodal
1a7fbe671b Implement _current_playlist_plchangesposid 2010-02-28 22:26:18 +01:00
Stein Magnus Jodal
e3b407c709 Implement _current_playlist_playlistid when songid argument is given 2010-02-28 22:15:15 +01:00
Stein Magnus Jodal
3180d7faf2 Implement _current_playlist_moveid 2010-02-28 21:15:01 +01:00
Stein Magnus Jodal
00472ca1bc Implement _current_playlist_move_{range,songpos} 2010-02-28 21:10:53 +01:00
Stein Magnus Jodal
434fbb8853 Add 'Last-Modified' field to _stored_playlists_listplaylists response 2010-02-28 20:07:11 +01:00
Stein Magnus Jodal
9846f7a738 Split _current_playlist_delete into a method for songpos and a method for ranges 2010-02-28 17:41:10 +01:00
Stein Magnus Jodal
6c538ba947 Add extra asserts to _current_playlist_deleteid tests 2010-02-28 17:14:29 +01:00
Stein Magnus Jodal
7e94f69e6e Implement _current_playlist_clear 2010-02-28 17:09:28 +01:00
Stein Magnus Jodal
54f538555c Implement _current_playlist_addid 2010-02-28 17:05:43 +01:00
Stein Magnus Jodal
71fc316709 Implement _current_playlist_add 2010-02-28 16:57:16 +01:00
Stein Magnus Jodal
3dedb8ced3 Implement _current_playlist_delete 2010-02-28 16:46:39 +01:00
Stein Magnus Jodal
93e5a417e5 Add 'elapsed' to 'status' output and increase MPD protocol version to 0.16.0 2010-02-28 16:27:18 +01:00
Stein Magnus Jodal
d62ea93231 Rename internal MpdHandler methods to include MPD protocol section 2010-02-28 15:23:25 +01:00
Stein Magnus Jodal
1b9231d384 Update tests to match changes from knutz3n 2010-02-28 13:43:40 +01:00
Stein Magnus Jodal
e61ce61741 Implement MpdHandler.find_exact() 2010-02-24 08:40:28 +01:00
Stein Magnus Jodal
635adabb7f Add test for 'noidle' 2010-02-23 19:48:27 +01:00
Stein Magnus Jodal
ca7152d62c Implement and test 'listplaylist' and 'listplaylistinfo' 2010-02-23 19:47:22 +01:00
Stein Magnus Jodal
31a05e6518 Update test after decorator rename 2010-02-22 23:33:10 +01:00
Stein Magnus Jodal
0a6545f6d0 Add volume control support to BaseBackend through alsaaudio.Mixer 2010-02-22 19:47:25 +01:00
Stein Magnus Jodal
59f1307d83 Update 'currentsong' test 2010-02-15 23:22:37 +01:00
Stein Magnus Jodal
4e16e403d2 Test behaviour when errors happens during command_list processing 2010-02-14 01:54:03 +01:00
Stein Magnus Jodal
39c44bfed6 Update tests for 'deleteid' 2010-02-14 01:47:42 +01:00
Stein Magnus Jodal
afa107f31d Add empty handlers for sticker commands 2010-02-14 01:43:00 +01:00
Stein Magnus Jodal
328191d657 Add some missing MPD commands 2010-02-14 01:20:54 +01:00
Stein Magnus Jodal
01a6751ce6 Add support for 'outputs' MPD command 2010-02-13 20:11:42 +01:00
Stein Magnus Jodal
552b3ac723 Fix tests and coverage for track status output 2010-02-13 19:58:19 +01:00
Stein Magnus Jodal
e3e5f0c9bb Add tests to get full test coverage of MpdHandler 2010-02-12 23:33:28 +01:00
Stein Magnus Jodal
80b1f377b6 Fix broken MpdHandler tests 2010-02-12 22:59:59 +01:00