Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
113141bf
Commit
113141bf
authored
Jul 17, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
StateFileConfig: add attribute "restore_paused"
parent
bcc1e510
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
8 deletions
+12
-8
StateFile.cxx
src/StateFile.cxx
+1
-1
StateFileConfig.cxx
src/StateFileConfig.cxx
+2
-1
StateFileConfig.hxx
src/StateFileConfig.hxx
+2
-0
PlaylistState.cxx
src/queue/PlaylistState.cxx
+4
-5
PlaylistState.hxx
src/queue/PlaylistState.hxx
+3
-1
No files found.
src/StateFile.cxx
View file @
113141bf
...
@@ -129,7 +129,7 @@ try {
...
@@ -129,7 +129,7 @@ try {
while
((
line
=
file
.
ReadLine
())
!=
nullptr
)
{
while
((
line
=
file
.
ReadLine
())
!=
nullptr
)
{
success
=
read_sw_volume_state
(
line
,
partition
.
outputs
)
||
success
=
read_sw_volume_state
(
line
,
partition
.
outputs
)
||
audio_output_state_read
(
line
,
partition
.
outputs
)
||
audio_output_state_read
(
line
,
partition
.
outputs
)
||
playlist_state_restore
(
line
,
file
,
song_loader
,
playlist_state_restore
(
config
,
line
,
file
,
song_loader
,
partition
.
playlist
,
partition
.
playlist
,
partition
.
pc
);
partition
.
pc
);
#ifdef ENABLE_DATABASE
#ifdef ENABLE_DATABASE
...
...
src/StateFileConfig.cxx
View file @
113141bf
...
@@ -30,7 +30,8 @@ constexpr std::chrono::steady_clock::duration StateFileConfig::DEFAULT_INTERVAL;
...
@@ -30,7 +30,8 @@ constexpr std::chrono::steady_clock::duration StateFileConfig::DEFAULT_INTERVAL;
StateFileConfig
::
StateFileConfig
(
const
ConfigData
&
config
)
StateFileConfig
::
StateFileConfig
(
const
ConfigData
&
config
)
:
path
(
config
.
GetPath
(
ConfigOption
::
STATE_FILE
)),
:
path
(
config
.
GetPath
(
ConfigOption
::
STATE_FILE
)),
interval
(
config
.
GetUnsigned
(
ConfigOption
::
STATE_FILE_INTERVAL
,
interval
(
config
.
GetUnsigned
(
ConfigOption
::
STATE_FILE_INTERVAL
,
DEFAULT_INTERVAL
))
DEFAULT_INTERVAL
)),
restore_paused
(
config
.
GetBool
(
ConfigOption
::
RESTORE_PAUSED
,
false
))
{
{
#ifdef ANDROID
#ifdef ANDROID
if
(
path
.
IsNull
())
{
if
(
path
.
IsNull
())
{
...
...
src/StateFileConfig.hxx
View file @
113141bf
...
@@ -34,6 +34,8 @@ struct StateFileConfig {
...
@@ -34,6 +34,8 @@ struct StateFileConfig {
std
::
chrono
::
steady_clock
::
duration
interval
;
std
::
chrono
::
steady_clock
::
duration
interval
;
bool
restore_paused
;
explicit
StateFileConfig
(
const
ConfigData
&
config
);
explicit
StateFileConfig
(
const
ConfigData
&
config
);
bool
IsEnabled
()
const
noexcept
{
bool
IsEnabled
()
const
noexcept
{
...
...
src/queue/PlaylistState.cxx
View file @
113141bf
...
@@ -27,12 +27,11 @@
...
@@ -27,12 +27,11 @@
#include "PlaylistError.hxx"
#include "PlaylistError.hxx"
#include "Playlist.hxx"
#include "Playlist.hxx"
#include "SingleMode.hxx"
#include "SingleMode.hxx"
#include "StateFileConfig.hxx"
#include "queue/QueueSave.hxx"
#include "queue/QueueSave.hxx"
#include "fs/io/TextFile.hxx"
#include "fs/io/TextFile.hxx"
#include "fs/io/BufferedOutputStream.hxx"
#include "fs/io/BufferedOutputStream.hxx"
#include "player/Control.hxx"
#include "player/Control.hxx"
#include "config/Global.hxx"
#include "config/Option.hxx"
#include "util/CharUtil.hxx"
#include "util/CharUtil.hxx"
#include "util/StringAPI.hxx"
#include "util/StringAPI.hxx"
#include "util/StringCompare.hxx"
#include "util/StringCompare.hxx"
...
@@ -128,7 +127,8 @@ playlist_state_load(TextFile &file, const SongLoader &song_loader,
...
@@ -128,7 +127,8 @@ playlist_state_load(TextFile &file, const SongLoader &song_loader,
}
}
bool
bool
playlist_state_restore
(
const
char
*
line
,
TextFile
&
file
,
playlist_state_restore
(
const
StateFileConfig
&
config
,
const
char
*
line
,
TextFile
&
file
,
const
SongLoader
&
song_loader
,
const
SongLoader
&
song_loader
,
struct
playlist
&
playlist
,
PlayerControl
&
pc
)
struct
playlist
&
playlist
,
PlayerControl
&
pc
)
{
{
...
@@ -183,8 +183,7 @@ playlist_state_restore(const char *line, TextFile &file,
...
@@ -183,8 +183,7 @@ playlist_state_restore(const char *line, TextFile &file,
if
(
!
playlist
.
queue
.
IsValidPosition
(
current
))
if
(
!
playlist
.
queue
.
IsValidPosition
(
current
))
current
=
0
;
current
=
0
;
if
(
state
==
PlayerState
::
PLAY
&&
if
(
state
==
PlayerState
::
PLAY
&&
config
.
restore_paused
)
config_get_bool
(
ConfigOption
::
RESTORE_PAUSED
,
false
))
/* the user doesn't want MPD to auto-start
/* the user doesn't want MPD to auto-start
playback after startup; fall back to
playback after startup; fall back to
"pause" */
"pause" */
...
...
src/queue/PlaylistState.hxx
View file @
113141bf
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#ifndef MPD_PLAYLIST_STATE_HXX
#ifndef MPD_PLAYLIST_STATE_HXX
#define MPD_PLAYLIST_STATE_HXX
#define MPD_PLAYLIST_STATE_HXX
struct
StateFileConfig
;
struct
playlist
;
struct
playlist
;
struct
PlayerControl
;
struct
PlayerControl
;
class
TextFile
;
class
TextFile
;
...
@@ -36,7 +37,8 @@ playlist_state_save(BufferedOutputStream &os, const playlist &playlist,
...
@@ -36,7 +37,8 @@ playlist_state_save(BufferedOutputStream &os, const playlist &playlist,
PlayerControl
&
pc
);
PlayerControl
&
pc
);
bool
bool
playlist_state_restore
(
const
char
*
line
,
TextFile
&
file
,
playlist_state_restore
(
const
StateFileConfig
&
config
,
const
char
*
line
,
TextFile
&
file
,
const
SongLoader
&
song_loader
,
const
SongLoader
&
song_loader
,
playlist
&
playlist
,
PlayerControl
&
pc
);
playlist
&
playlist
,
PlayerControl
&
pc
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment