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
b0739eca
Commit
b0739eca
authored
Feb 05, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test/ConfigGlue: merge duplicate code from various debug programs
parent
848f6aa5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
78 additions
and
81 deletions
+78
-81
ConfigGlue.hxx
test/ConfigGlue.hxx
+41
-0
DumpDatabase.cxx
test/DumpDatabase.cxx
+3
-9
RunChromaprint.cxx
test/RunChromaprint.cxx
+7
-13
dump_playlist.cxx
test/dump_playlist.cxx
+3
-7
run_decoder.cxx
test/run_decoder.cxx
+8
-14
run_filter.cxx
test/run_filter.cxx
+3
-8
run_input.cxx
test/run_input.cxx
+8
-14
run_neighbor_explorer.cxx
test/run_neighbor_explorer.cxx
+3
-7
run_output.cxx
test/run_output.cxx
+2
-9
No files found.
test/ConfigGlue.hxx
0 → 100644
View file @
b0739eca
/*
* Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_TEST_CONFIG_GLUE_HXX
#define MPD_TEST_CONFIG_GLUE_HXX
#include "config/File.hxx"
#include "config/Migrate.hxx"
#include "config/Data.hxx"
#include "fs/Path.hxx"
inline
ConfigData
AutoLoadConfigFile
(
Path
path
)
{
ConfigData
data
;
if
(
!
path
.
IsNull
())
{
ReadConfigFile
(
data
,
path
);
Migrate
(
data
);
}
return
data
;
}
#endif
test/DumpDatabase.cxx
View file @
b0739eca
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -26,11 +26,7 @@
#include "db/LightDirectory.hxx"
#include "song/LightSong.hxx"
#include "db/PlaylistVector.hxx"
#include "config/File.hxx"
#include "config/Migrate.hxx"
#include "config/Data.hxx"
#include "config/Param.hxx"
#include "config/Block.hxx"
#include "ConfigGlue.hxx"
#include "tag/Config.hxx"
#include "fs/Path.hxx"
#include "event/Thread.hxx"
...
...
@@ -124,9 +120,7 @@ try {
GlobalInit
init
;
ConfigData
config
;
ReadConfigFile
(
config
,
config_path
);
Migrate
(
config
);
const
auto
config
=
AutoLoadConfigFile
(
config_path
);
TagLoadConfig
(
config
);
...
...
test/RunChromaprint.cxx
View file @
b0739eca
...
...
@@ -17,9 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config/File.hxx"
#include "config/Migrate.hxx"
#include "config/Data.hxx"
#include "ConfigGlue.hxx"
#include "tag/Chromaprint.hxx"
#include "pcm/PcmConvert.hxx"
#include "event/Thread.hxx"
...
...
@@ -90,18 +88,13 @@ ParseCommandLine(int argc, char **argv)
}
class
GlobalInit
{
ConfigData
config
;
const
ConfigData
config
;
EventThread
io_thread
;
public
:
GlobalInit
(
Path
config_path
,
bool
verbose
)
{
SetLogThreshold
(
verbose
?
LogLevel
::
DEBUG
:
LogLevel
::
INFO
);
if
(
!
config_path
.
IsNull
())
{
ReadConfigFile
(
config
,
config_path
);
Migrate
(
config
);
}
explicit
GlobalInit
(
Path
config_path
)
:
config
(
AutoLoadConfigFile
(
config_path
))
{
io_thread
.
Start
();
input_stream_global_init
(
config
,
...
...
@@ -245,7 +238,8 @@ int main(int argc, char **argv)
try
{
const
auto
c
=
ParseCommandLine
(
argc
,
argv
);
const
GlobalInit
init
(
c
.
config_path
,
c
.
verbose
);
SetLogThreshold
(
c
.
verbose
?
LogLevel
::
DEBUG
:
LogLevel
::
INFO
);
const
GlobalInit
init
(
c
.
config_path
);
const
DecoderPlugin
*
plugin
=
decoder_plugin_from_name
(
c
.
decoder
);
if
(
plugin
==
nullptr
)
{
...
...
test/dump_playlist.cxx
View file @
b0739eca
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -21,9 +21,7 @@
#include "song/DetachedSong.hxx"
#include "playlist/SongEnumerator.hxx"
#include "input/InputStream.hxx"
#include "config/File.hxx"
#include "config/Migrate.hxx"
#include "config/Data.hxx"
#include "ConfigGlue.hxx"
#include "decoder/DecoderList.hxx"
#include "input/Init.hxx"
#include "event/Thread.hxx"
...
...
@@ -61,9 +59,7 @@ try {
/* initialize MPD */
ConfigData
config
;
ReadConfigFile
(
config
,
config_path
);
Migrate
(
config
);
const
auto
config
=
AutoLoadConfigFile
(
config_path
);
EventThread
io_thread
;
io_thread
.
Start
();
...
...
test/run_decoder.cxx
View file @
b0739eca
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,9 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config/File.hxx"
#include "config/Migrate.hxx"
#include "config/Data.hxx"
#include "ConfigGlue.hxx"
#include "event/Thread.hxx"
#include "decoder/DecoderList.hxx"
#include "decoder/DecoderPlugin.hxx"
...
...
@@ -88,18 +86,13 @@ ParseCommandLine(int argc, char **argv)
}
class
GlobalInit
{
ConfigData
config
;
const
ConfigData
config
;
EventThread
io_thread
;
public
:
GlobalInit
(
Path
config_path
,
bool
verbose
)
{
SetLogThreshold
(
verbose
?
LogLevel
::
DEBUG
:
LogLevel
::
INFO
);
if
(
!
config_path
.
IsNull
())
{
ReadConfigFile
(
config
,
config_path
);
Migrate
(
config
);
}
explicit
GlobalInit
(
Path
config_path
)
:
config
(
AutoLoadConfigFile
(
config_path
))
{
io_thread
.
Start
();
input_stream_global_init
(
config
,
...
...
@@ -117,7 +110,8 @@ int main(int argc, char **argv)
try
{
const
auto
c
=
ParseCommandLine
(
argc
,
argv
);
const
GlobalInit
init
(
c
.
config_path
,
c
.
verbose
);
SetLogThreshold
(
c
.
verbose
?
LogLevel
::
DEBUG
:
LogLevel
::
INFO
);
const
GlobalInit
init
(
c
.
config_path
);
const
DecoderPlugin
*
plugin
=
decoder_plugin_from_name
(
c
.
decoder
);
if
(
plugin
==
nullptr
)
{
...
...
test/run_filter.cxx
View file @
b0739eca
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,10 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config/Param.hxx"
#include "config/Data.hxx"
#include "config/File.hxx"
#include "config/Migrate.hxx"
#include "ConfigGlue.hxx"
#include "fs/Path.hxx"
#include "AudioParser.hxx"
#include "AudioFormat.hxx"
...
...
@@ -77,9 +74,7 @@ try {
/* read configuration file (mpd.conf) */
ConfigData
config
;
ReadConfigFile
(
config
,
config_path
);
Migrate
(
config
);
const
auto
config
=
AutoLoadConfigFile
(
config_path
);
/* parse the audio format */
...
...
test/run_input.cxx
View file @
b0739eca
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -20,9 +20,7 @@
#include "config.h"
#include "TagSave.hxx"
#include "tag/Tag.hxx"
#include "config/File.hxx"
#include "config/Migrate.hxx"
#include "config/Data.hxx"
#include "ConfigGlue.hxx"
#include "input/InputStream.hxx"
#include "input/Init.hxx"
#include "input/Registry.hxx"
...
...
@@ -103,7 +101,7 @@ ParseCommandLine(int argc, char **argv)
}
class
GlobalInit
{
ConfigData
config
;
const
ConfigData
config
;
EventThread
io_thread
;
#ifdef ENABLE_ARCHIVE
...
...
@@ -111,14 +109,9 @@ class GlobalInit {
#endif
public
:
GlobalInit
(
Path
config_path
,
bool
verbose
)
{
SetLogThreshold
(
verbose
?
LogLevel
::
DEBUG
:
LogLevel
::
INFO
);
if
(
!
config_path
.
IsNull
())
{
ReadConfigFile
(
config
,
config_path
);
Migrate
(
config
);
}
explicit
GlobalInit
(
Path
config_path
)
:
config
(
AutoLoadConfigFile
(
config_path
))
{
io_thread
.
Start
();
input_stream_global_init
(
config
,
...
...
@@ -234,7 +227,8 @@ try {
/* initialize MPD */
const
GlobalInit
init
(
c
.
config_path
,
c
.
verbose
);
SetLogThreshold
(
c
.
verbose
?
LogLevel
::
DEBUG
:
LogLevel
::
INFO
);
const
GlobalInit
init
(
c
.
config_path
);
if
(
c
.
scan
)
return
Scan
(
c
.
uri
);
...
...
test/run_neighbor_explorer.cxx
View file @
b0739eca
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,9 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config/File.hxx"
#include "config/Migrate.hxx"
#include "config/Data.hxx"
#include "ConfigGlue.hxx"
#include "neighbor/Listener.hxx"
#include "neighbor/Info.hxx"
#include "neighbor/Glue.hxx"
...
...
@@ -57,14 +55,12 @@ try {
/* initialize the core */
ConfigData
config
;
EventLoop
loop
;
const
ShutdownHandler
shutdown_handler
(
loop
);
/* read configuration file (mpd.conf) */
ReadConfigFile
(
config
,
config_path
);
Migrate
(
config
);
const
auto
config
=
AutoLoadConfigFile
(
config_path
);
/* initialize neighbor plugins */
...
...
test/run_output.cxx
View file @
b0739eca
...
...
@@ -20,12 +20,7 @@
#include "output/Interface.hxx"
#include "output/Registry.hxx"
#include "output/OutputPlugin.hxx"
#include "config/Param.hxx"
#include "config/Data.hxx"
#include "config/File.hxx"
#include "config/Migrate.hxx"
#include "config/Option.hxx"
#include "config/Block.hxx"
#include "ConfigGlue.hxx"
#include "event/Thread.hxx"
#include "fs/Path.hxx"
#include "AudioParser.hxx"
...
...
@@ -122,9 +117,7 @@ try {
/* read configuration file (mpd.conf) */
ConfigData
config
;
ReadConfigFile
(
config
,
config_path
);
Migrate
(
config
);
const
auto
config
=
AutoLoadConfigFile
(
config_path
);
EventThread
io_thread
;
io_thread
.
Start
();
...
...
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