{"action":"created","issue":{"url":"https://api.github.com/repos/mopidy/mopidy/issues/1376","labels_url":"https://api.github.com/repos/mopidy/mopidy/issues/1376/labels{/name}","comments_url":"https://api.github.com/repos/mopidy/mopidy/issues/1376/comments","events_url":"https://api.github.com/repos/mopidy/mopidy/issues/1376/events","html_url":"https://github.com/mopidy/mopidy/pull/1376","id":123995554,"number":1376,"title":"core: Persist mopidy state between runs. Fix #310","user":{"login":"dublok","id":15618662,"avatar_url":"https://avatars.githubusercontent.com/u/15618662?v=3","gravatar_id":"","url":"https://api.github.com/users/dublok","html_url":"https://github.com/dublok","followers_url":"https://api.github.com/users/dublok/followers","following_url":"https://api.github.com/users/dublok/following{/other_user}","gists_url":"https://api.github.com/users/dublok/gists{/gist_id}","starred_url":"https://api.github.com/users/dublok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dublok/subscriptions","organizations_url":"https://api.github.com/users/dublok/orgs","repos_url":"https://api.github.com/users/dublok/repos","events_url":"https://api.github.com/users/dublok/events{/privacy}","received_events_url":"https://api.github.com/users/dublok/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-12-27T20:41:07Z","updated_at":"2016-01-07T19:43:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mopidy/mopidy/pulls/1376","html_url":"https://github.com/mopidy/mopidy/pull/1376","diff_url":"https://github.com/mopidy/mopidy/pull/1376.diff","patch_url":"https://github.com/mopidy/mopidy/pull/1376.patch"},"body":"I implemented writing/reading the core state to/from disk. Please review and comment.\r\n\r\nInstead of using a get_state() method (as recommended in #310), the core controller themselves knows what to export/import.\r\n\r\nDone:\r\n- moved json export/import write_library()/load_library() from mopidy/local to mopidy/models\r\n- new core methods save_state(), load_state()\r\n- save_state(), load_state() accessible via rpc\r\n- save state to disk at stop\r\n- load state from disk at start\r\n- new config: core.restore_state (\"off\", \"load\", \"play\")\r\n- update documentation\r\n- Persist following properties:\r\n```\r\nmopidy.core.tracklist\r\n    _tl_tracks\r\n    _next_tlid\r\n    get_consume()\r\n    get_random()\r\n    get_repeat()\r\n    get_single()\r\nmopidy.core.history\r\n    _history\r\nmopidy.core.playlist\r\n    get_current_tl_track()\r\n    get_time_position()\r\nmopidy.core.mixer\r\n    get_volume()\r\n```\r\n\r\nTodo:\r\n- seek to play position does not work. Timing issue.\r\n- use extra thread to load state from disk at start?\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mopidy/mopidy/issues/comments/169785719","html_url":"https://github.com/mopidy/mopidy/pull/1376#issuecomment-169785719","issue_url":"https://api.github.com/repos/mopidy/mopidy/issues/1376","id":169785719,"user":{"login":"dublok","id":15618662,"avatar_url":"https://avatars.githubusercontent.com/u/15618662?v=3","gravatar_id":"","url":"https://api.github.com/users/dublok","html_url":"https://github.com/dublok","followers_url":"https://api.github.com/users/dublok/followers","following_url":"https://api.github.com/users/dublok/following{/other_user}","gists_url":"https://api.github.com/users/dublok/gists{/gist_id}","starred_url":"https://api.github.com/users/dublok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dublok/subscriptions","organizations_url":"https://api.github.com/users/dublok/orgs","repos_url":"https://api.github.com/users/dublok/repos","events_url":"https://api.github.com/users/dublok/events{/privacy}","received_events_url":"https://api.github.com/users/dublok/received_events","type":"User","site_admin":false},"created_at":"2016-01-07T19:43:56Z","updated_at":"2016-01-07T19:43:56Z","body":"Interesting hint. Counter question: Do we really need to query any backend? We ask indirect by filling the tracklist and trying to start the playback. \r\n\r\nIn case of mopidy-pandora at least `PandoraPlaybackProvider.translate_uri` will fail with an exception. (I had a only short look into mopidy-pandora source, but I can't test it, pandora is geo blocked in Germany.) \r\n\r\nI don't know if that is 'acceptable' or 'bad style' in mopidy.\r\n\r\n\r\n"}}