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
d1f85240
Commit
d1f85240
authored
Oct 31, 2018
by
Florian Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include hostname in zeroconf_name (fixes #387)
expand %h to the system hostname and default to a zeroconf string that contains %h
parent
2148d4bb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
5 deletions
+15
-5
mpd.conf.5
doc/mpd.conf.5
+2
-1
mpdconf.example
doc/mpdconf.example
+2
-2
user.rst
doc/user.rst
+2
-1
ZeroconfGlue.cxx
src/zeroconf/ZeroconfGlue.cxx
+9
-1
No files found.
doc/mpd.conf.5
View file @
d1f85240
...
...
@@ -99,7 +99,8 @@ information will be published with Zeroconf. The default is yes.
.B zeroconf_name <name>
If Zeroconf is enabled, this is the service name to publish. This name should
be unique to your local network, but name collisions will be properly dealt
with. The default is "Music Player".
with. The default is "Music Player @ %h", where %h will be replaced with the
hostname of the machine running MPD.
.TP
.B audio_output
See \fBDESCRIPTION\fP and the various \fBAUDIO OUTPUT PARAMETERS\fP sections
...
...
doc/mpdconf.example
View file @
d1f85240
...
...
@@ -151,9 +151,9 @@
#zeroconf_enabled "yes"
#
# The argument to this setting will be the Zeroconf / Avahi unique name for
# this MPD server on the network.
# this MPD server on the network.
%h will be replaced with the hostname.
#
#zeroconf_name "Music Player"
#zeroconf_name "Music Player
@ %h
"
#
###############################################################################
...
...
doc/user.rst
View file @
d1f85240
...
...
@@ -673,7 +673,8 @@ settings control this feature:
* - **zeroconf_enabled yes|no**
- Enables or disables this feature. Default is yes.
* - **zeroconf_name NAME**
- The service name to publish via Zeroconf. The default is "Music Player".
- The service name to publish via Zeroconf. The default is "Music Player @ %h".
%h will be replaced with the hostname of the machine running :program:`MPD`.
Advanced configuration
**********************
...
...
src/zeroconf/ZeroconfGlue.cxx
View file @
d1f85240
...
...
@@ -27,13 +27,16 @@
#include "util/Domain.hxx"
#include "Log.hxx"
#include "util/Compiler.h"
#include <unistd.h>
#include <limits.h>
#include <regex>
static
constexpr
Domain
zeroconf_domain
(
"zeroconf"
);
/* The default service name to publish
* (overridden by 'zeroconf_name' config parameter)
*/
#define SERVICE_NAME "Music Player"
#define SERVICE_NAME "Music Player
@ %h
"
#define DEFAULT_ZEROCONF_ENABLED 1
...
...
@@ -59,6 +62,11 @@ ZeroconfInit(const ConfigData &config, gcc_unused EventLoop &loop)
serviceName
=
config
.
GetString
(
ConfigOption
::
ZEROCONF_NAME
,
SERVICE_NAME
);
char
hostname
[
HOST_NAME_MAX
+
1
];
gethostname
(
hostname
,
HOST_NAME_MAX
);
std
::
string
sName
=
std
::
regex_replace
(
serviceName
,
std
::
regex
(
"%h"
),
hostname
);
serviceName
=
sName
.
c_str
();
#ifdef HAVE_AVAHI
AvahiInit
(
loop
,
serviceName
);
#endif
...
...
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