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
fe53a376
Commit
fe53a376
authored
Aug 04, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlaylistPlugin: pass config_param reference
parent
65842cd9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
13 deletions
+14
-13
PlaylistPlugin.hxx
src/PlaylistPlugin.hxx
+2
-2
PlaylistRegistry.cxx
src/PlaylistRegistry.cxx
+7
-5
LastFMPlaylistPlugin.cxx
src/playlist/LastFMPlaylistPlugin.cxx
+3
-3
SoundCloudPlaylistPlugin.cxx
src/playlist/SoundCloudPlaylistPlugin.cxx
+2
-3
No files found.
src/PlaylistPlugin.hxx
View file @
fe53a376
...
...
@@ -55,7 +55,7 @@ struct playlist_plugin {
* @return true if the plugin was initialized successfully,
* false if the plugin is not available
*/
bool
(
*
init
)(
const
struct
config_param
*
param
);
bool
(
*
init
)(
const
config_param
&
param
);
/**
* Deinitialize a plugin which was initialized successfully.
...
...
@@ -96,7 +96,7 @@ struct playlist_plugin {
*/
static
inline
bool
playlist_plugin_init
(
const
struct
playlist_plugin
*
plugin
,
const
struct
config_param
*
param
)
const
config_param
&
param
)
{
return
plugin
->
init
!=
NULL
?
plugin
->
init
(
param
)
...
...
src/PlaylistRegistry.cxx
View file @
fe53a376
...
...
@@ -83,8 +83,7 @@ playlist_plugin_config(const char *plugin_name)
assert
(
plugin_name
!=
NULL
);
while
((
param
=
config_get_next_param
(
CONF_PLAYLIST_PLUGIN
,
param
))
!=
NULL
)
{
const
char
*
name
=
config_get_block_string
(
param
,
"name"
,
NULL
);
const
char
*
name
=
param
->
GetBlockValue
(
"name"
);
if
(
name
==
NULL
)
MPD_ERROR
(
"playlist configuration without 'plugin' name in line %d"
,
param
->
line
);
...
...
@@ -99,17 +98,20 @@ playlist_plugin_config(const char *plugin_name)
void
playlist_list_global_init
(
void
)
{
const
config_param
empty
;
for
(
unsigned
i
=
0
;
playlist_plugins
[
i
]
!=
NULL
;
++
i
)
{
const
struct
playlist_plugin
*
plugin
=
playlist_plugins
[
i
];
const
struct
config_param
*
param
=
playlist_plugin_config
(
plugin
->
name
);
if
(
!
config_get_block_bool
(
param
,
"enabled"
,
true
))
if
(
param
==
nullptr
)
param
=
&
empty
;
else
if
(
!
param
->
GetBlockValue
(
"enabled"
,
true
))
/* the plugin is disabled in mpd.conf */
continue
;
playlist_plugins_enabled
[
i
]
=
playlist_plugin_init
(
playlist_plugins
[
i
],
param
);
playlist_plugin_init
(
playlist_plugins
[
i
],
*
param
);
}
}
...
...
src/playlist/LastFMPlaylistPlugin.cxx
View file @
fe53a376
...
...
@@ -44,10 +44,10 @@ static struct {
}
lastfm_config
;
static
bool
lastfm_init
(
const
struct
config_param
*
param
)
lastfm_init
(
const
config_param
&
param
)
{
const
char
*
user
=
config_get_block_string
(
param
,
"user"
,
NULL
);
const
char
*
passwd
=
config_get_block_string
(
param
,
"password"
,
NULL
);
const
char
*
user
=
param
.
GetBlockValue
(
"user"
);
const
char
*
passwd
=
param
.
GetBlockValue
(
"password"
);
if
(
user
==
NULL
||
passwd
==
NULL
)
{
g_debug
(
"disabling the last.fm playlist plugin "
...
...
src/playlist/SoundCloudPlaylistPlugin.cxx
View file @
fe53a376
...
...
@@ -35,10 +35,9 @@ static struct {
}
soundcloud_config
;
static
bool
soundcloud_init
(
const
struct
config_param
*
param
)
soundcloud_init
(
const
config_param
&
param
)
{
soundcloud_config
.
apikey
=
config_dup_block_string
(
param
,
"apikey"
,
NULL
);
soundcloud_config
.
apikey
=
param
.
DupBlockString
(
"apikey"
);
if
(
soundcloud_config
.
apikey
==
NULL
)
{
g_debug
(
"disabling the soundcloud playlist plugin "
"because API key is not set"
);
...
...
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