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
cb331ae4
Commit
cb331ae4
authored
Oct 13, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist_list: pass configuration to playlist plugins
This patch completes the configuration support.
parent
767e27c8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
2 deletions
+104
-2
user.xml
doc/user.xml
+62
-0
conf.c
src/conf.c
+1
-0
conf.h
src/conf.h
+1
-0
playlist_list.c
src/playlist_list.c
+40
-2
No files found.
doc/user.xml
View file @
cb331ae4
...
...
@@ -391,6 +391,68 @@ cd mpd-version</programlisting>
</tgroup>
</informaltable>
</section>
<section>
<title>
Configuring playlist plugins
</title>
<para>
Playlist plugins are used to load remote playlists. This is
not related to MPD's playlist directory.
</para>
<para>
To configure a filter, add a
<varname>
playlist_plugin
</varname>
block to
<filename>
mpd.conf
</filename>
:
</para>
<programlisting>
playlist_plugin {
name "m3u"
enabled "true"
}
</programlisting>
<para>
The following table lists the
<varname>
playlist_plugin
</varname>
options valid for all
plugins:
</para>
<informaltable>
<tgroup
cols=
"2"
>
<thead>
<row>
<entry>
Name
</entry>
<entry>
Description
</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<varname>
name
</varname>
</entry>
<entry>
The name of the plugin.
</entry>
</row>
<row>
<entry>
<varname>
enabled
</varname>
<parameter>
yes|no
</parameter>
</entry>
<entry>
Allows you to disable a input plugin without
recompiling. By default, all plugins are enabled.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>
</chapter>
<chapter>
...
...
src/conf.c
View file @
cb331ae4
...
...
@@ -90,6 +90,7 @@ static struct config_entry config_entries[] = {
{
.
name
=
CONF_DECODER
,
true
,
true
},
{
.
name
=
CONF_INPUT
,
true
,
true
},
{
.
name
=
CONF_GAPLESS_MP3_PLAYBACK
,
false
,
false
},
{
.
name
=
CONF_PLAYLIST_PLUGIN
,
true
,
true
},
{
.
name
=
"filter"
,
true
,
true
},
};
...
...
src/conf.h
View file @
cb331ae4
...
...
@@ -67,6 +67,7 @@
#define CONF_DECODER "decoder"
#define CONF_INPUT "input"
#define CONF_GAPLESS_MP3_PLAYBACK "gapless_mp3_playback"
#define CONF_PLAYLIST_PLUGIN "playlist_plugin"
#define DEFAULT_PLAYLIST_MAX_LENGTH (1024*16)
#define DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS false
...
...
src/playlist_list.c
View file @
cb331ae4
...
...
@@ -23,10 +23,12 @@
#include "input_stream.h"
#include "uri.h"
#include "utils.h"
#include "conf.h"
#include <glib.h>
#include <assert.h>
#include <string.h>
static
const
struct
playlist_plugin
*
const
playlist_plugins
[]
=
{
&
m3u_playlist_plugin
,
...
...
@@ -36,12 +38,48 @@ static const struct playlist_plugin *const playlist_plugins[] = {
/** which plugins have been initialized successfully? */
static
bool
playlist_plugins_enabled
[
G_N_ELEMENTS
(
playlist_plugins
)];
/**
* Find the "playlist" configuration block for the specified plugin.
*
* @param plugin_name the name of the playlist plugin
* @return the configuration block, or NULL if none was configured
*/
static
const
struct
config_param
*
playlist_plugin_config
(
const
char
*
plugin_name
)
{
const
struct
config_param
*
param
=
NULL
;
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
);
if
(
name
==
NULL
)
g_error
(
"playlist configuration without 'plugin' name in line %d"
,
param
->
line
);
if
(
strcmp
(
name
,
plugin_name
)
==
0
)
return
param
;
}
return
NULL
;
}
void
playlist_list_global_init
(
void
)
{
for
(
unsigned
i
=
0
;
playlist_plugins
[
i
]
!=
NULL
;
++
i
)
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
))
/* the plugin is disabled in mpd.conf */
continue
;
playlist_plugins_enabled
[
i
]
=
playlist_plugin_init
(
playlist_plugins
[
i
],
NULL
);
playlist_plugin_init
(
playlist_plugins
[
i
],
param
);
}
}
void
...
...
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