Commit Graph

90 Commits

Author SHA1 Message Date
Jens Luetjen
4869619bb9 New CoreState to hold all core states
- Introduce a CoreState class that holds all core states
- Move xState classes to internal
- Use validation.check_instance for consistent error messages
- Store tlid instead of TlTrack to restore last played track
2016-01-10 13:24:14 +01:00
Jens Luetjen
6e99a95aae Don't modify data in library function.
- storage.save: Don't modify data. mopidy.__version__ has to be added by caller.
- storage.load: Added a Todo. Postponed decision, if load() shall raise an exception in case of error. See PR #310.
2016-01-09 12:05:14 +01:00
Jens Luetjen
a9327c559f Don't use pykka callbacks on_start and on_stop.
Introduce setup() and teardown() for Core.
2016-01-09 12:00:35 +01:00
Jens Luetjen
0b0cbc87d4 Merge branch 'develop' into fix/310-persist-mopidy-state-between-runs
Conflicts:
	docs/changelog.rst

Fixed conflict in doc/changelog.rst
2016-01-05 08:16:51 +01:00
Jens Luetjen
6746dd0196 More function for config value core.restore_state
- New values for core.restore_state : "volume", "last"
- Update changelog
- Adjust logger output
2016-01-05 07:41:02 +01:00
Jens Luetjen
e56c39ee78 Add unit tests for export/restore core state
Fix issues shown by test code
2016-01-03 18:29:35 +01:00
Jens Luetjen
a5a9178b06 Use model(s) to save/restore current play state 2016-01-02 15:28:41 +01:00
Jens Luetjen
44841710e0 Use data_dir instead of config_dir.
Mopidy as service can not write to config_dir.
2015-12-27 21:03:00 +01:00
Jens Luetjen
e9625e9feb core: Fix #310: Persist mopidy state between runs.
Persist following properties:
mopidy.core.tracklist
    _tl_tracks
    _next_tlid
    get_consume()
    get_random()
    get_repeat()
    get_single()
mopidy.core.history
    _history
mopidy.core.playlist
    get_current_tl_track()
    get_time_position()
mopidy.core.mixer
    get_volume()

Details:
- moved json export/import write_library()/load_library() from mopidy/local to mopidy/models
- new core methods save_state(), load_state()
- save_state(), load_state() accessible via rpc
- save state to disk at stop
- load state from disk at start
- new config: core.restore_state ("off", "load", "play")

TODO:
- seek to play position does not work. Timing issue.
- use extra thread to load state from disk at start?
2015-12-27 19:28:41 +01:00
Thomas Adamcik
aeb881896b core: Trigger position changed from audio events.
Makes sure to only fire when the position changed to our intended seek target.
Otherwise we would also be triggering this when playback starts.
2015-12-04 21:10:48 +01:00
Thomas Adamcik
e12ea662da Merge branch 'develop' into feature/implement-gapless 2015-09-02 21:03:17 +02:00
Stein Magnus Jodal
326f8579ca core: Add quotes around URI scheme in log message 2015-08-11 10:03:33 +02:00
Thomas Adamcik
3fe9f7b3a7 Merge branch 'develop' into feature/implement-gapless
Conflicts:
	mopidy/commands.py
	mopidy/core/playback.py
	tests/core/test_playback.py
	tests/local/test_playback.py
2015-07-22 20:00:46 +02:00
Thomas Adamcik
8c7b3c69fb core: Assume backend.has_* calls could fail 2015-05-12 23:55:09 +02:00
Stein Magnus Jodal
d8bcd7f273 Rename mopidy.utils to mopidy.internal 2015-05-07 23:15:56 +02:00
Thomas Adamcik
0afe8ef54c docs: Improve core actor docs 2015-04-23 23:42:30 +02:00
Stein Magnus Jodal
c5c9bc39e1 core: Get access to config
Needed for #997
2015-04-09 07:30:37 +02:00
Thomas Adamcik
11c9aa4ad0 Merge branch 'develop' into feature/implement-gapless
Conflicts:
	mopidy/backend.py
	mopidy/commands.py
	mopidy/core/actor.py
	mopidy/core/playback.py
	tests/audio/test_actor.py
	tests/core/test_playback.py
	tests/local/test_playback.py
2015-04-05 19:24:56 +02:00
Stein Magnus Jodal
c4940cbea2 autopep8: Add space after class signature/docstring 2015-04-03 00:05:26 +02:00
Thomas Adamcik
07f0453c6e core: Make event triggers internal 2015-03-23 00:50:05 +01:00
Stein Magnus Jodal
a05c097106 docs: Change deprecated-in from 0.20 to 1.0
Fixes #1051
2015-03-18 22:00:00 +01:00
Thomas Adamcik
28d047e1d2 core: Only emit stream title changed for streams
This is done by checking for the presence of the organization tag typically set
by web streams. This might be a bit to strict and a bad heuristic, but it's
currently better than wrongly emitting stream titles for non streams IMO.
2015-03-15 11:42:01 +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
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
Ali Ukani
92910e4362 Fix flake8 tests
Fixes "W503 line break before binary operator"
2015-02-16 02:02:14 -05: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
42115c56f7 core: Add mixer controller (fixes: #962)
Deprecate volume and mute methods on playback controller.
2015-02-12 10:31:16 +01:00
Stein Magnus Jodal
8f8fa4d414 core: Emit deprecation warnings
The warnings appear as warning level log messages if running Python on
the mopidy/ directory like this:

    python -W all mopidy -v

or:

    python -W all mopidy -o loglevels/py.warnings=warning

We don't suppress warnings when Pykka is the caller in general, but just
when Pykka is looking at all properties to create its actor proxies.

When a deprecated property is used from another Pykka actor, only the
stack for the current actor thread is available for inspection, so the
warning cannot show where the actual call site in the other actor thread
is. Though, if the warnings are made exceptions with:

    python -W error mopidy

then the stack traces will include the frames from all involved actor
threads, showing where the original call site is.
2015-02-11 00:29:52 +01:00
Stein Magnus Jodal
5827e45c34 core: Use getters/setters internally in core
This fixes all the easy-to-track warnings.
2015-02-11 00:17:12 +01:00
Stein Magnus Jodal
352de135cd core: Deprecate properties (fixes #952) 2015-02-11 00:17:12 +01:00
Stein Magnus Jodal
b7ed2b8681 core: Fix variable naming, style 2015-02-10 23:12:03 +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
ccd91c0b72 core: Pass audio in to playback 2015-01-21 23:28:57 +01:00
Alexandre Petitjean
64cab9ae95 Rename current_md_track to current_metadata_track 2015-01-20 21:50:02 +01:00
Alexandre Petitjean
ef950a5e15 Adds audio in Core 2015-01-20 20:01:54 +01:00
Alexandre Petitjean
eeed2973f1 Fix metadata refresh with more than one pl in tracklist 2015-01-17 14:30:40 +01:00
Alexandre Petitjean
7ee1935315 MPD gets metadata's updates from stream 2015-01-16 23:45:07 +01:00
Alexandre Petitjean
e4dd04cfb7 One step beyond 2015-01-16 21:41:55 +01:00
Alexandre Petitjean
ec94449a63 Handle tags_changed in Core and send event to CoreListener 2015-01-15 22:25:34 +01:00
Stein Magnus Jodal
496142c201 py3: Use absolute imports by default 2014-12-07 20:17:10 +01: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
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
0bf7302005 Merge remote-tracking branch 'adamcik/fix/gh-734-cleanup-audio-buffering' into develop
Conflicts:
	mopidy/audio/actor.py
2014-07-20 12:29:49 +02:00
Thomas Adamcik
4c666e47ee core: Ignore buffering for now 2014-07-15 00:31:13 +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