--var-dir \
-d --daemon \
config-test \
- generate-config"
+ generate-config \
+ purge-history"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
.\" Title: mpd-sima
.\" Author: kaliko <kaliko@azylum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
-.\" Date: 04/22/2021
+.\" Date: 04/23/2021
.\" Manual: mpd-sima 0.17.0 User Manual
.\" Source: mpd-sima
.\" Language: English
.\"
-.TH "MPD\-SIMA" "1" "04/22/2021" "mpd-sima" "mpd-sima 0.17.0 User Manual"
+.TH "MPD\-SIMA" "1" "04/23/2021" "mpd-sima" "mpd-sima 0.17.0 User Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
\fBmpd\-sima\fR create\-db [\fB\-\-var\-dir=\fR\fIvar_directory\fR]
.HP \w'\fBmpd\-sima\fR\ 'u
\fBmpd\-sima\fR generate\-config [\fB\&...\fR]
+.HP \w'\fBmpd\-sima\fR\ 'u
+\fBmpd\-sima\fR purge\-history [\fB\-\-var\-dir=\fR\fIvar_directory\fR]
.SH "DESCRIPTION"
.PP
This manual page documents briefly the
.RS 4
Generate a sample configuration file according to the current CLI options and env\&. var\&.\&. The configuration is written on stdout\&.
.RE
+.PP
+\fBpurge\-history\fR
+.RS 4
+Purge play history in the database and exit\&. Uses folder specified with
+\fB\-\-var\-dir\fR
+or default directory\&.
+.br
+Default is to use
+\fB$XDG_DATA_HOME/mpd_sima/\fR
+(see
+the section called \(lqFILES\(rq
+for more)\&.
+.RE
.SH "FILES"
.PP
${XDG_CONFIG_HOME}/mpd_sima/mpd_sima\&.cfg
<arg choice="plain">generate-config</arg>
<arg choice="opt"><option>…</option></arg>
</cmdsynopsis>
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+ <arg choice="plain">purge-history</arg>
+ <arg choice="opt"><option>--var-dir=</option><replaceable class="option">var_directory</replaceable></arg>
+ </cmdsynopsis>
</refsynopsisdiv>
<refsect1 id="description">
<title>DESCRIPTION</title>
<para>Generate a sample configuration file according to the current CLI options and env. var.. The configuration is written on stdout.</para>
</listitem>
</varlistentry>
+ <varlistentry> <!-- purge-history -->
+ <term><option>purge-history</option></term>
+ <listitem>
+ <para>Purge play history in the database and exit. Uses folder specified with <option>--var-dir</option> or default directory.<sbr />Default is to use <envar>$XDG_DATA_HOME/mpd_sima/</envar> (see <xref linkend="files"/> for more).</para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
<xi:include href="files.xml" />
* Use duration instead of time in Track objects (closes #37)
* Move "test-tags-config" as positional argument "config-test"
* Move "--create-db" as positional argument "create-db"
- * Add commands as positional arguments:
- config-test, create-db, generate-config
+ * Add mpd-sima commands as positional arguments:
+ config-test, create-db, generate-config, purge-history
-- kaliko <kaliko@azylum.org> UNRELEASED
else:
logger.info('Database already there, not overwriting %s', db_file)
sys.exit(0)
+ if cmd == "purge-history":
+ db_file = config.get('sima', 'db_file')
+ if not isfile(db_file):
+ logger.warning('No db found: %s', db_file)
+ sys.exit(1)
+ SimaDB(db_path=db_file).purge_history(duration=0)
+ sys.exit(0)
+
# TODO: To remove eventually in next major realese v0.18
# Create Database
CMDS = {'config-test': 'Test configuration (MPD connection and Tags plugin only)',
'create-db': 'Create the database',
'generate-config': 'Generate a configuration file to stdout',
+ 'purge-history': 'Remove play history'
}
# OPTIONS LIST
# pop out 'sw' value before creating Parser object.