Commit Graph

259 Commits

Author SHA1 Message Date
Ronald Zielaznicki
82ed660777 Add core config values to relevent test cases. 2015-07-19 23:05:39 -04:00
Stein Magnus Jodal
87bf261345 tests: Fix typo in mock usage
The error was made evident by a newer mock version that no longer
swallowed the wrong assert as regular use of a spec-less mock.
2015-07-16 21:33:02 +02:00
Mark Greenwood
38ca65a0b6 Fix #1218 - Last-Modified timestamp for tracks
Don't know why the Travis build failed, it's passing for me
2015-07-13 06:43:46 +01:00
Mark Greenwood
6d2ac7a100 Fix #1218
Output a track's Last-Modified stamp in ISO 8601 format, as MPD does.

Output nothing if track has no last-modified stamp.

The test has to use datetime to work out what the output will look like,
because it is local-time zone dependant.
2015-07-13 06:35:34 +01:00
Mark Greenwood
5c6ab0846e Fix #1218
Output the last_modified timestamp from mopidy's track model to mpd clients
in the same format as mpd uses - yyyy-mm-ddTHH:MM:SS

Outputs nothing for Last-Modified if last_modified is None
2015-07-12 21:39:27 +01:00
Mark Greenwood
f3f140c19f mpd:Update protocol to 0.19
Address issues raised in review:
Fix formatting by shortening function name to concat_multi_values
Change comments and variable names to reflect generic nature of function
Fix typos in tests
Default to single quotes for strings
2015-07-06 09:26:52 +01:00
Mark Greenwood
a2f2d5f167 mpd:Update protocol to 0.19
Update tests to reflect new function names
2015-07-05 13:40:45 +01:00
Stein Magnus Jodal
749c8baceb Merge branch 'v1.0.x' into develop
Conflicts:
	mopidy/core/library.py
	tests/core/test_playback.py
2015-06-25 23:15:35 +02:00
Naglis Jonaitis
feb9963a8e mpd: Ignore tracks without length in the "count" command 2015-05-28 01:40:38 +03:00
Thomas Adamcik
2b3e976bc9 core: Update title distinct name to track 2015-05-20 23:14:46 +02:00
Stein Magnus Jodal
d8bcd7f273 Rename mopidy.utils to mopidy.internal 2015-05-07 23:15:56 +02:00
Thomas Adamcik
651e89357f tests: Fix IssueGH1120RegressionTest flakiness 2015-04-26 23:23:30 +02:00
Thomas Adamcik
b3ea425fd0 tests: Fix IssueGH1120RegressionTest flakiness 2015-04-24 19:26:02 +02:00
Stein Magnus Jodal
3dba4f4208 Merge branch 'v1.0.x' into develop 2015-04-23 23:40:04 +02:00
Thomas Adamcik
d4c695ac75 mpd: Split browse and playlist name to uri caching 2015-04-23 23:08:25 +02:00
Thomas Adamcik
efad50c253 cleanup: Stop using deprecated copy() 2015-04-17 00:00:58 +02:00
Thomas Adamcik
1b10a783d3 mpd: Update tests to use setters and actual booleans 2015-04-13 00:16:09 +02:00
Thomas Adamcik
9b442e1563 review: Address review comments 2015-04-06 23:27:46 +02:00
Thomas Adamcik
8f96bf0f39 tests: Fix some model use oddities 2015-04-05 13:08:15 +02:00
Stein Magnus Jodal
c4940cbea2 autopep8: Add space after class signature/docstring 2015-04-03 00:05:26 +02:00
Thomas Adamcik
9ede14f4a1 tests: Convert to using deprecation helpers across the board. 2015-03-30 23:50:54 +02:00
Thomas Adamcik
c85689edad mpd: Make mpd warnings safe with respect to tracklist.add(tracks=...) 2015-03-29 23:11:00 +02:00
Thomas Adamcik
f7399c1849 tests: Stop using playlist filters in mpd music_db tests 2015-03-29 23:11:00 +02:00
Thomas Adamcik
79b0584887 tests: Stop using tracklist add tracks in mpd status test 2015-03-29 23:11:00 +02:00
Thomas Adamcik
7d42d028c6 tests: Stop using tracklist tracks in mpd playback tests 2015-03-29 23:11:00 +02:00
Thomas Adamcik
faf8174ef7 tests: Update mpd.test_status to not use tracklist.add(tracks=...) 2015-03-29 23:11:00 +02:00
Thomas Adamcik
a8860faa35 tests: Cleanup mpd.protocol.current_playlist tests
- Split into smaller test cases more or less per command
- Created a BasePopulatedTracklistTestCase with a sensible setUp
- Modified test cases to work with the common tracklist state
- Replaced all calls to tracklist.add(tracks=...) with uris=...
- Test tracklist ordering in more compact way that also gives better error
  messages
2015-03-29 23:11:00 +02:00
Thomas Adamcik
b31f0c421f tests: Make tests warning safe 2015-03-26 21:58:44 +01:00
Stein Magnus Jodal
2c11344434 dummy: Make it obvious that method is test-only 2015-03-25 13:16:27 +01:00
Stein Magnus Jodal
f2a56edbf0 dummy: Replace playlists property with test-only helper 2015-03-25 00:03:56 +01:00
Stein Magnus Jodal
0f21e7425e Merge pull request #1039 from adamcik/bug/923/duration-as-int-or-none
core: Correctly handle missing duration in seek.
2015-03-15 21:26:16 +01:00
Thomas Adamcik
6adeea6009 core: Correctly handle missing duration in seek.
Seeks will now fail when the duration is None, this is an approximation to if
the track is seekable or not. This check is need as otherwise seeking a radio
stream will trigger the next track.

If the track truly isn't seekable despite having a duration we should still
fail as GStreamer will reject the seek.
2015-03-15 11:29:07 +01:00
Stein Magnus Jodal
336ef4534a tests: Use assertEqual instead of assertEquals 2015-03-14 23:01:49 +01:00
Stein Magnus Jodal
b29f9e10c4 core: get_mute() with no mixer returns None
...and not False, because the mute state is unknown (None) and not
unmuted (False) when there is no mixer.

Note that this change does not affect the MPD responses.
2015-03-13 21:19:56 +01:00
Lasse Bigum
cb19b2c48c Allow 'none' as audio.mixer value
To disable mixing altogether, you can now set the configuration value
 audio/mixer to 'none'.
2015-03-10 00:26:22 +01:00
Thomas Adamcik
8cc9c9bbc0 core: Rename list_distinct to get_distinct 2015-03-02 22:41:09 +01:00
Thomas Adamcik
5fd2afa7ca mpd: Switch list command to using list_distinct 2015-03-02 00:26:51 +01:00
Thomas Adamcik
e4ba4b3e5f mpd: Support blacklisting MPD commands in the server.
Default blacklist set to listall and listallinfo.

This change has been done to avoid clients being able to call "bad" MPD
commands which are often misused to try and keep a client db. Note that
this change will break some MPD clients, but the blacklist can be controlled
via config to allow opting out for now.
2015-02-18 00:13:24 +01:00
Stein Magnus Jodal
b554a64aad mixer: Move DummyMixer into tests package 2015-02-13 01:37:07 +01:00
Stein Magnus Jodal
df95a988b7 backend: Move DummyBackend into tests package 2015-02-13 01:37:07 +01:00
Stein Magnus Jodal
160afbcd26 mpd: Use DummyMixer in tests 2015-02-13 01:22:46 +01:00
Thomas Adamcik
3cb9eb52f0 Merge pull request #975 from jodal/feature/core-mixer
Add core.mixer replacing playback mixer methods.
2015-02-12 23:50:04 +01:00
Stein Magnus Jodal
e938fb0a7f Merge pull request #965 from ZenithDK/fix/flake-lambda
flake8: fix PEP8 warnings about lambda
2015-02-12 22:22:53 +01:00
Lasse Bigum
34ada2784a flake8: fix PEP8 warnings about lambda
Fix the 'lambda to def' warnings
2015-02-12 22:10:36 +01:00
Stein Magnus Jodal
e1fa76a48e mpd: Use core.mixer for volume/mute 2015-02-12 10:31:16 +01:00
kingosticks
0de13994c2 Moved MPDUriMapper to own file and updated changelog 2015-02-09 12:07:17 +00:00
kingosticks
317d02de3e Pass MPDUrimapper into mpd test setup 2015-02-08 23:43:22 +00:00
Thomas Adamcik
627b856578 tests: Fix MPD tests helper names 2014-12-30 00:23:08 +01:00
Thomas Adamcik
fa8547c397 tests: Add noqa markers for setUp/tearDown 2014-12-30 00:23:01 +01:00
Thomas Adamcik
a50ba6e3a7 tests: Add noqa markers to custom assert helpers 2014-12-29 23:58:36 +01:00
Thomas Adamcik
08a8d5c43b mpd: Remove "Comment" tag type from translator output.
Newer versions of the protocol have removed this tag, so we should as well.
This also works around the issue of #881 which was breaking things with
newlines in comment fields.

The readcomments command seems to replace this, but it seems to only care about
specific extra tagtypes, not the general comment tag we normally collect when
scanning things.
2014-12-14 14:16:37 +01:00
Stein Magnus Jodal
4e508cd017 mpd: Enable browsing of empty dirs
This was disabled together with a bunch of other changes without any
explanation in commit f24ca36e5a. I'm
guessing that this wasn't intentional, and no test covered the case.
2014-12-13 01:27:14 +01:00
Stein Magnus Jodal
7a1bb224f7 py3: Avoid indexing exception objects
It doesn't work on Python 3.
2014-12-07 20:26:09 +01:00
Stein Magnus Jodal
496142c201 py3: Use absolute imports by default 2014-12-07 20:17:10 +01:00
Thomas Kemmer
63277c4db3 Add unit tests for artist browsing 2014-11-04 19:22:45 +01:00
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