Commit Graph

210 Commits

Author SHA1 Message Date
Thomas Adamcik
ea97047607 flake8: Fix bad import 2015-03-14 00:10:21 +01:00
Thomas Adamcik
4db4b4d63b core: Reduce stream metadata to just the title
The API I really want for this to support regular tracks, stream updates and
dynamic playlists is still unclear to me. As such I'm taking the KISS approach
and reducing this to just the stream title and nothing else.

If all goes as planed this will be replaced by playback_track_changed(tlid, ref)
style events and other improvements in a later version.
2015-03-13 23:56:51 +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
Thomas Adamcik
6fcd43891e core: Switch to reference based stream info.
- Adds tests for new behaviors in core.
- Adds stream name to MPD format (fixes #944)
- Adds 'stream_changed' core event (needs a new name/event)
- Adds 'get_stream_reference' (which I'm also unsure about)

The bits I'm unsure about are mostly with respect to #270, but I'm going ahead
with this commit so we can discuss the details in PR with this code as an
example.
2015-03-10 21:55:51 +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
Lasse Bigum
cf0b666a0a Add tests for PlaybackController get_current_(tl_)track
Add some more test cases for PlaybackController
2015-03-08 04:10:02 +01:00
Lasse Bigum
fbd534efbf Don't change to playing state when seeking in paused state
Do not switch state from paused to playing when seeking
2015-03-01 15:50:17 +01:00
Stein Magnus Jodal
df95a988b7 backend: Move DummyBackend into tests package 2015-02-13 01:37:07 +01:00
Stein Magnus Jodal
886c2b92d8 core: Use a mixer mock in tests 2015-02-13 01:15:25 +01:00
Stein Magnus Jodal
638740541b Merge pull request #981 from adamcik/feature/core-get-images
Add library.get_images()
2015-02-13 00:33:29 +01:00
Thomas Adamcik
ddd872cdea core: Always return an answer for all URIs in get_images
Also make sure that results are tuples instead of lists so we don't
accidentally give out mutable state.
2015-02-13 00:10:14 +01:00
Thomas Adamcik
533948f8f8 core: Make sure we return list of images in get_images tests 2015-02-12 23:10:20 +01:00
Thomas Adamcik
c0b0e3657a core: Add core.library.get_images 2015-02-12 22:38:42 +01:00
Stein Magnus Jodal
42115c56f7 core: Add mixer controller (fixes: #962)
Deprecate volume and mute methods on playback controller.
2015-02-12 10:31:16 +01:00
Thomas Adamcik
b0aebaf993 core: Make sure current_tl_track changes on stream change
- Adds stream changed handler to core
- Moves playback started trigger to stream changed
- Made about to finish store next track in _pending_tl_track
- Set the pending track as current in stream changed
- Adds tests for all of this and fixes existing tests
2015-01-23 00:14:30 +01:00
Thomas Adamcik
49f16704d8 core: Remove on_end_of_track from playback
This has been replaced by on_about_to_finish and on_end_of_stream.
Tests have been updated to reflect these changes.
2015-01-22 23:16:51 +01:00
Thomas Adamcik
82bf1c0eb9 core: Move core.playback.on_end_of_track off change_track helper
Only handles the playing case, unlike the previous and next changes. It should
also be noted that this is just a temporary state on the road to making this
method handle gapless.
2015-01-21 23:15:42 +01:00
Thomas Adamcik
4a39671ee7 core: Move core.playback.previous off change_track helper
Same fix as for core.playback.next and mostly the same caveats.
2015-01-21 23:07:47 +01:00
Thomas Adamcik
bbb3301a98 core: Move core.playback.next off change_track helper
Note that since this doesn't use play via change_track we have to copy over the
tracking code and make sure it is only run for the playing case
2015-01-21 23:02:06 +01:00
Thomas Adamcik
9fc319055c backend: Change playback API (breaking change)
While trying to remove traces of stop calls in core to get gapless working I
found we had no way to switch to switch tracks without triggering a play. This
change fixes this by changing the backends playback provider API.

- play() now _only_ starts playback and does not take any arguments.
- prepare_change() has been added, this could have been avoided with a kwarg to
  change_track(track), but that would break more backends.
- core has been updated to call prepare_change+change_track+play as needed.
- tests have been updated to handle this change.

Longer term I hope to completely rework the playback API in backends, as 99% of
our backends only use change_track(track) to translate URIs. So we should make
simple case simple, and handle mopidy-spotify / appsrc in some other way.
2015-01-21 22:13:41 +01:00
Thomas Adamcik
fa8547c397 tests: Add noqa markers for setUp/tearDown 2014-12-30 00:23:01 +01:00
Stein Magnus Jodal
dbbb86e6c0 Merge branch 'release/v0.19.x' into develop
Conflicts:
	mopidy/core/playback.py
2014-12-24 00:24:19 +01:00
Stein Magnus Jodal
c6ff9eee86 playback: Remove skipped track on next in consume mode
Also adds core level tests of consume behavior on next/prev/eot.

Fixes #902
2014-12-24 00:04:41 +01:00
Stein Magnus Jodal
496142c201 py3: Use absolute imports by default 2014-12-07 20:17:10 +01:00
Stein Magnus Jodal
7856c14b26 tests: Use with stmt for assertRaises 2014-09-25 23:03:35 +02:00
Stein Magnus Jodal
5317834baf history: Change size property to get_length() method
For consistency with tracklist.get_length() and our goal of aligning Python
and JS APIs by using less properties in the core API.
2014-09-23 18:47:54 +02:00
Stein Magnus Jodal
5a67339855 history: Cleanup history entry test 2014-09-23 18:47:39 +02:00
Stein Magnus Jodal
d30cf68efd history: Raise TypeError if non-Tracks are added 2014-09-23 18:42:41 +02:00
Stein Magnus Jodal
718405421d history: Rename class to HistoryController
For consistency with other core controllers.
2014-09-23 18:32:37 +02:00
Arjun Naik
c38b9f378f Use assertIn instead of assertTrue to test membership. 2014-09-23 18:09:12 +02:00
Arjun Naik
9006968f75 TrackHistory stores Ref instances. Timestamp as epoch in milliseconds also stored. 2014-09-23 18:09:12 +02:00
Arjun Naik
ed87ab8dd1 Added a playback history object to the core. 2014-09-23 18:09:11 +02:00
Stein Magnus Jodal
d15d66f070 Use 'mute' instead of 'muted', to avoid changing old APIs 2014-07-12 03:14:19 +02:00
Stein Magnus Jodal
a3dc763b29 core: Forward {volume,mute}_changed events, don't trigger them ourselves 2014-07-10 01:15:44 +02:00
Stein Magnus Jodal
6d6bc4b808 core: Use new mixer API 2014-07-08 01:11:25 +02:00
dz0ny
d871ca9128 Remove duplicates from library root.
Closes #708
2014-06-26 16:27:22 +02:00
Stein Magnus Jodal
b754885064 Fix all import order warnings 2014-05-07 20:08:43 +02:00
Stein Magnus Jodal
1ea0978af5 dummy: Move dummy backend back into the mopidy package 2014-01-18 01:38:10 +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
c781f77ef3 Rename test files to pattern expected by test runners 2014-01-15 00:01:50 +01:00
Stein Magnus Jodal
1d108752f6 core: Make events emitted on playback consistent (fixes #629)
This commit does not try to make the events correct/perfect with regard to
GStreamer states, end-of-stream signalling, etc. It only tries to make the
events work consistently across all the methods on the playback controller.

* play(track) while already playing has changed from:

  - playback_state_changed(old_state='playing', new_state='playing')
  - track_playback_started(track=...)

  to:

  - playback_state_changed(old_state='playing', new_state='stopped')
  - track_playback_ended(track=..., time_position=...)
  - playback_state_changed(old_state='stopped', new_state='playing')
  - track_playback_started(track=...)

* next() has changed from:

  - track_playback_ended(track=..., time_position=...)
  - playback_state_changed(old_state='playing', new_state='stopped')
  - track_playback_ended(track=..., time_position=0)
  - playback_state_changed(old_state='stopped', new_state='playing')
  - track_playback_started(track=...)

  to same as play() above.

* previous() has changed in the same way as next().

* on_end_of_track() has changed from:

  - track_playback_ended(track=..., time_position=...)
  - playback_state_changed(old_state='playing', new_state='playing')
  - track_playback_started(track=...)

  to same as play() above.

* stop() has reordered its events from:

  - track_playback_ended(track=..., time_position=...)
  - playback_state_changed(old_state='playing', new_state='stopped')

  to:

  - playback_state_changed(old_state='playing', new_state='stopped')
  - track_playback_ended(track=..., time_position=...)
2014-01-14 01:18:39 +01:00
Stein Magnus Jodal
05632c3b8b backend: Update backend API imports 2014-01-11 18:20:45 +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
Stein Magnus Jodal
252f4792a0 core: Check if library is browsable at startup 2014-01-03 23:12:03 +01:00
Stein Magnus Jodal
69836d2e16 backend: Rename library.name to library.root_directory_name 2014-01-03 23:10:02 +01:00
Stein Magnus Jodal
af3b0e40fd models: Add Ref.type constants 2014-01-03 22:19:54 +01:00
Stein Magnus Jodal
048c3bb544 core: Use library name instead of URI scheme in browse() 2014-01-02 23:10:15 +01:00
Stein Magnus Jodal
6027ed1fac core: Add library.browse() 2014-01-02 22:06:33 +01:00
Thomas Adamcik
e82ce6256d core: Re-add one uri scheme per backend constraint. 2013-12-31 14:45:57 +01:00
Stein Magnus Jodal
3859448e06 core: Test version property, fix typo in changelog 2013-12-15 22:49:33 +01:00
Thomas Adamcik
3bbcb4d121 local: Review comment fixes 2013-11-28 23:20:03 +01:00
Thomas Adamcik
04044d035f core: Refactor core Backends helper
Replaces the jungle of extra dicts/lists with an OrderedDict per backend
feature type. Also makes sure that each type/scheme is unique instead of
the scheme alone.
2013-11-27 00:04:51 +01:00
Stein Magnus Jodal
04788abaac core: Change tracklist.{filter,remove} usage
The criterias are now a mapping between field names and one or more values.
This aligns tracklist.{filter,remove} with the API of
library.{find_exact,search}, and allows for e.g. batch removals.

An exception is raised immediately if the API is used in the old way to ease
migration and debugging.
2013-11-12 00:00:22 +01:00
Stein Magnus Jodal
863f7e0430 mpd: Trigger 'output' idle event on mute_changed()
This is required for e.g. ncmpcpp to detect that an enableoutput/disableoutput
command worked, making it possible to toggle the output back without restarting
ncmpcpp.
2013-10-09 23:52:59 +02:00
Stein Magnus Jodal
447864774e core: Add volume arg to volume_changed() event
It was already called with the argument, and both the MPD and HTTP frontends
handled it/expected it. It was just the default implementation in CoreListener
that lacked the argument.
2013-10-09 23:51:01 +02:00
Stein Magnus Jodal
6a3e322845 core: Tweak mute docs, add simple test case 2013-10-09 23:24:17 +02:00
Stein Magnus Jodal
52ee456692 tests: Import unittest directly from the stdlib 2013-04-29 19:45:25 +02:00
Thomas Adamcik
6f39bde566 config: Start passing dummy config explicitly to audio/backends/frontends. 2013-04-02 19:14:46 +02:00
Stein Magnus Jodal
06c7d8ea46 Merge branch 'develop' into feature/limit-search-by-uri-root
Conflicts:
	docs/changes.rst
2013-03-31 12:45:31 +02:00
Stein Magnus Jodal
bfd2010639 core: Let tracklist.add() lookup tracks by URI 2013-03-31 00:13:59 +01:00
Stein Magnus Jodal
2abce2af38 core: Limit search to backends matching URI roots
Fixes #337
2013-03-30 22:20:19 +01:00
Stein Magnus Jodal
1704828504 backends: Make search/find_exact take a query dict instead of kwargs 2013-03-30 22:14:33 +01:00
Stein Magnus Jodal
2eb9ad710a core: Add 'include_tracks' argument to 'get_playlists()' 2013-01-06 21:04:27 +01:00
Thomas Adamcik
f1bd092e63 core: Update tests with cases for filtering out None results. 2013-01-01 17:31:06 +01:00
Stein Magnus Jodal
b0ba2040df Return SearchResult objects from find_exact() and search()
This applies to both backends and core.
2012-12-21 22:05:20 +01:00
Stein Magnus Jodal
ea37cf1a44 core: Include the TlTrack in track_playback_* events 2012-12-19 17:06:04 +01:00
Stein Magnus Jodal
e176425b91 core: Test that 'seeked' event includes 'time_position' 2012-12-19 16:35:52 +01:00
Stein Magnus Jodal
9602fff8bb tests: Formatting 2012-12-19 16:33:59 +01:00
Stein Magnus Jodal
c5ac7aeb77 core: Include new volume level in volume_changed event 2012-12-19 16:31:58 +01:00
Stein Magnus Jodal
0d7b22b745 tests: Don't need audio actor for code event tests 2012-12-19 14:59:05 +01:00
Trygve Aaberge
88b3bd4934 tests: Test that set volume triggers volume changed 2012-12-18 18:09:00 +01:00
Stein Magnus Jodal
59ccc207ea core: Make all methods callable without kwargs, e.g. from Mopidy.js 2012-12-17 15:38:32 +01:00
Stein Magnus Jodal
cc2510bd56 tests: Rename core.playlist tests so it is included in test runs 2012-12-17 15:19:52 +01:00
Stein Magnus Jodal
6238f55ae2 core: Add CoreListener.on_event()
The `on_event()` method is called on all events. By default, it forwards the
event to the specific event handler methods. It's also a convenient method to
override if you want to handle all events in one place.
2012-11-30 22:39:37 +01:00
Stein Magnus Jodal
ae9a257091 Make tracklist.add() only take and return lists 2012-11-20 22:12:09 +01:00
Stein Magnus Jodal
1ed56c9ed7 Use tracklist.add() instead of tracklist.append() 2012-11-20 21:55:51 +01:00
Stein Magnus Jodal
eab399357f Make library.lookup() return a list of tracks 2012-11-19 21:09:10 +01:00
Stein Magnus Jodal
7df556c9b3 Return lists of tracks from search() and find_exact() 2012-11-19 18:13:14 +01:00
Stein Magnus Jodal
6f0919bda8 style: Fix flake8 warnings 2012-11-19 18:01:31 +01:00
Stein Magnus Jodal
330731a247 core: Forward playlists_loaded() event from backends to frontends 2012-11-17 01:22:25 +01:00
Stein Magnus Jodal
426d5aea16 core: Trigger playlists_loaded() after playlist refresh 2012-11-17 00:42:03 +01:00
Stein Magnus Jodal
5526ee5a95 core: Add CoreListener.playlists_loaded() event 2012-11-17 00:42:03 +01:00
Stein Magnus Jodal
4efff4a5a3 core: Trigger playlist_changed() event on create() and save() 2012-11-16 23:50:30 +01:00
Stein Magnus Jodal
fd86b7173c core: Add playlist to playlist_changed() event 2012-11-16 23:50:01 +01:00
Stein Magnus Jodal
0e7f867d67 core: Test tracklist event trigging 2012-11-16 13:54:55 +01:00
Stein Magnus Jodal
d378fd7160 tests: Move events tests from tests/backends/ to tests/core 2012-11-16 11:53:48 +01:00
Stein Magnus Jodal
476df7a14d core: Add tracklist_changed() event 2012-11-16 11:43:49 +01:00
Stein Magnus Jodal
3a24deaec3 Rename 'stored playlists' to 'playlists' 2012-11-14 09:23:19 +01:00
Stein Magnus Jodal
bba9548b27 Rename 'current playlist' to 'tracklist' 2012-11-13 10:59:48 +01:00
Stein Magnus Jodal
344d5bd49d Merge pull request #238 from jodal/feature/optional-backend-providers
Make all three backend provider types optional
2012-11-13 01:41:18 -08:00
Stein Magnus Jodal
6acaa490e9 Make all strings unicode by default (fixes #224) 2012-11-13 00:18:47 +01:00
Stein Magnus Jodal
92bd599ecf Update stored playlists controller to support backends without playlists 2012-11-12 22:38:49 +01:00
Stein Magnus Jodal
d748c07daf Update playback controller to support backends without playback support 2012-11-12 22:19:27 +01:00
Stein Magnus Jodal
6f32d72792 Update the library controller to support backends without a library 2012-11-12 21:41:48 +01:00
Stein Magnus Jodal
6c49a7fc52 Make core.stored_playlists.save() support multibackend (#217) 2012-10-31 16:59:28 +01:00
Stein Magnus Jodal
3d05f3c65f Change stored_playlists.delete() to accepting an URI (#217) 2012-10-31 16:59:28 +01:00
Stein Magnus Jodal
fd88b974e8 Make core.stored_playlists.refresh() support multibackend (#217) 2012-10-31 16:59:28 +01:00
Stein Magnus Jodal
8cc1896b9d Make core.stored_playlists.lookup() support multibackend (#217) 2012-10-31 16:59:28 +01:00
Stein Magnus Jodal
e2474da1ef Make core.stored_playlists.create() support multibackend (#217) 2012-10-31 16:59:28 +01:00
Stein Magnus Jodal
1014c6e373 Include both involved backends in the error message 2012-10-29 10:50:18 +01:00
Stein Magnus Jodal
4a79b559d5 Fail if two backends claims to handle the same URI schema 2012-10-29 10:31:35 +01:00
Stein Magnus Jodal
0641d2d207 Make core.stored_playlists.playlists support multiple backends 2012-10-28 11:10:40 +01:00
Stein Magnus Jodal
a35deec050 Make core.library support multiple backends 2012-10-28 11:10:39 +01:00
Stein Magnus Jodal
c47cec9e65 Make core.playback select backend based on track URI 2012-10-28 11:10:39 +01:00
Stein Magnus Jodal
7b9c682e95 Make core.uri_schemes include URI schemes from all backends 2012-10-28 11:10:39 +01:00
Stein Magnus Jodal
e7f08a7a20 Rename mopidy.{listeners.BackendListener => core.CoreListener} 2012-09-27 20:35:39 +02:00
Stein Magnus Jodal
0559213da3 Move backend controllers to mopidy.core 2012-09-13 23:41:20 +02:00