.\" Title: mpd-sima
.\" Author: Jack Kaliko <kaliko@azylum.org>
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 02/08/2015
+.\" Date: 02/12/2015
.\" Manual: mpd-sima 0.14.0 User Manual
.\" Source: mpd-sima
.\" Language: English
.\"
-.TH "MPD\-SIMA" "1" "02/08/2015" "mpd-sima" "mpd-sima 0.14.0 User Manual"
+.TH "MPD\-SIMA" "1" "02/12/2015" "mpd-sima" "mpd-sima 0.14.0 User Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.HP \w'\fBmpd\-sima\fR\ 'u
\fBmpd\-sima\fR [\fB\-\-daemon\fR] [\fB\-\-config=\fR\fIconf_file\fR] [\fB\-\-var_dir=\fR\fIvar_directory\fR] [\fB\-\-pid=\fR\fIpid_file\fR] [\fB\-\-log=\fR\fIlog_file\fR] [\fB\-\-log\-level=\fR\fIlog_level\fR] [\fB\-\-host=\fR\fImpd_host\fR] [\fB\-\-mpd_port=\fR\fImpd_port\fR]
.HP \w'\fBmpd\-sima\fR\ 'u
-\fBmpd\-sima\fR [\fB\-\-var_dir=\fR\fIvar_directory\fR] [\fB\-\-create\-db\fR]
+\fBmpd\-sima\fR \-\-create\-db [\fB\-\-var_dir=\fR\fIvar_directory\fR]
.HP \w'\fBmpd\-sima\fR\ 'u
-\fBmpd\-sima\fR [{\fB\-h\fR\ |\ \fB\-\-help\fR} | \fB\-\-version\fR]
+\fBmpd\-sima\fR \-\-generate\-config [\fB\&...\fR]
+.HP \w'\fBmpd\-sima\fR\ 'u
+\fBmpd\-sima\fR {{\fB\-h\fR\ |\ \fB\-\-help\fR}\ \fB\-\-version\fR}
.SH "DESCRIPTION"
.PP
This manual page documents briefly the
the section called \(lqFILES\(rq
.RE
.PP
+\fB\-\-generate\-config\fR
+.RS 4
+Generate a sample configuration file according to the current configuration\&. You can put other options with this one to get them in the generated configuration\&.
+.RE
+.PP
\fB\-\-create\-db\fR
.RS 4
Create the database and exit\&. Uses folder specified with
.RS 4
Default is to look for MPD server at localhost:6600 (or MPD_HOST/MPD_PORT env\&. var\&. if set)\&.
.sp
-The default behavior is to add one track, this track is to be chosen among titles from artists similar to the last artist in the queue\&. MPD_sima will add one track when the unplayed queue is one track long\&.
+The get the defaults as detected by mpd\-sima on your system you can run mpd\-sima to print the config:
.sp
-To change these defaults, use the configuration file
-mpd_sima\&.cfg
+\fBmpd\-sima \-\-generate\-config\fR
.RE
.PP
For details about mpd_sima\&.cfg refer to the manual
</cmdsynopsis>
<cmdsynopsis>
<command>&dhpackage;</command>
+ <arg choice="plain">--create-db</arg>
<arg choice="opt"><option>--var_dir=</option><replaceable class="option">var_directory</replaceable></arg>
- <arg choice="opt"><option>--create-db</option></arg>
+ </cmdsynopsis>
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+ <arg choice="plain">--generate-config</arg>
+ <arg choice="opt"><option>…</option></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>&dhpackage;</command>
<!-- Normally the help and version options make the programs stop
right after outputting the requested information. -->
- <group choice="opt">
- <arg choice="plain">
+ <group choice="plain">
+ <arg choice="req">
<group choice="req">
<arg choice="plain"><option>-h</option></arg>
<arg choice="plain"><option>--help</option></arg>
</group>
+ <arg choice="plain"><option>--version</option></arg>
</arg>
- <arg choice="plain"><option>--version</option></arg>
</group>
</cmdsynopsis>
</refsynopsisdiv>
<para>Use the specific path <replaceable>var_directory</replaceable> to look for (or create) var files (ie. database) instead of looking at the default user data location.<sbr />Default is to look in <envar>$XDG_DATA_HOME/mpd_sima/</envar>. Concerning <envar>$XDG_DATA_HOME</envar> see also <xref linkend="files"/></para>
</listitem>
</varlistentry>
+ <varlistentry> <!-- generate-config -->
+ <term><option>--generate-config</option></term>
+ <listitem>
+ <para>Generate a sample configuration file according to the current configuration. You can put other options with this one to get them in the generated configuration.</para>
+ </listitem>
+ </varlistentry>
<varlistentry> <!-- create-db -->
<term><option>--create-db</option></term>
<listitem>
<term>DEFAULTS</term>
<listitem>
<para>Default is to look for MPD server at localhost:6600 (or MPD_HOST/MPD_PORT env. var. if set).</para>
- <para>The default behavior is to add one track, this
- track is to be chosen among titles from artists
- similar to the last artist in the queue. MPD_sima
- will add one track when the unplayed queue is one
- track long.</para>
- <para>To change these defaults, use the configuration file <filename>mpd_sima.cfg</filename></para>
+ <para>The get the defaults as detected by &dhpackage; on your system you can run &dhpackage; to print the config:</para>
+ <para><command>&dhpackage; --generate-config</command></para>
</listitem>
</varlistentry>
</variablelist>
MPD_sima v0.14.0
+ * Add option to generate config on stdout
* Add priority feature for plugins
* More robust MPD client
* Fixed top track mode
if artist.mbid:
# we already performed a lookup on artists with mbid set
# search through remaining artists
- artists = self._cache.get('nombid_artists', [])
+ artists = self._cache.get('nombid_artists')
else:
- artists = self._cache.get('artists', [])
+ artists = self._cache.get('artists')
match = get_close_matches(artist.name, artists, 50, 0.73)
if not match and not found:
return
verbosity = sopt.options.get('verbosity', 'warning')
# loads configuration
config = ConfMan(sopt.options).config
- logfile = config.get('log', 'logfile')
+ logfile = config.get('log', 'logfile', fallback=None)
verbosity = config.get('log', 'verbosity')
set_logger(verbosity, logfile)
logger = logging.getLogger('sima')
logger.info('Done, bye...')
sys.exit(0)
+ if sopt.options.get('generate_config'):
+ config.write(sys.stdout, space_around_delimiters=True)
+ sys.exit(0)
+
logger.info('Starting...')
sima = core.Sima(config)
argparse.
"""
ok = True
- for op, ftochk in [('log', self.config['log']['logfile']),
- ('pidfile', self.config['daemon']['pidfile']),]:
+ for op, ftochk in [('logfile', self.config.get('log','logfile')),
+ ('pidfile', self.config.get('daemon', 'pidfile')),]:
if not ftochk:
continue
if isdir(ftochk):
'dest': 'conf_file',
'action': Rfile,
'help': 'Configuration file to load'},
+ {
+ 'sw':['--generate-config'],
+ 'dest': 'generate_config',
+ 'action': 'store_true',
+ 'help': 'Generate a sample configuration file to stdout according to the current\
+ configuration. You can put other options with this one to get them in\
+ the generated configuration.'},
{
'sw':['--var_dir'],
'dest': 'var_dir',