From e703692c1f6f2cbac143c19dac2fb5800be8b6ea Mon Sep 17 00:00:00 2001 From: kaliko Date: Mon, 14 Dec 2020 15:09:38 +0100 Subject: [PATCH] Document new offline autoqueue plugin based on file tags only --- data/man/mpd_sima.cfg.5 | 100 +++++++++++++++++++++++++++++++--- data/man/mpd_sima.cfg.5.xml | 70 ++++++++++++++++++++++-- doc/Changelog | 1 + doc/examples/all_settings.cfg | 20 +++++++ sima/utils/config.py | 8 +++ 5 files changed, 186 insertions(+), 13 deletions(-) diff --git a/data/man/mpd_sima.cfg.5 b/data/man/mpd_sima.cfg.5 index 7fb9853..345864f 100644 --- a/data/man/mpd_sima.cfg.5 +++ b/data/man/mpd_sima.cfg.5 @@ -2,12 +2,12 @@ .\" Title: mpd_sima.cfg .\" Author: kaliko .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 05/11/2020 +.\" Date: 12/14/2020 .\" Manual: mpd-sima 0.16.0 User Manual .\" Source: mpd-sima .\" Language: English .\" -.TH "MPD_SIMA\&.CFG" "5" "05/11/2020" "mpd-sima" "mpd-sima 0.16.0 User Manual" +.TH "MPD_SIMA\&.CFG" "5" "12/14/2020" "mpd-sima" "mpd-sima 0.16.0 User Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,9 +36,40 @@ This manual page documents briefly configuration options available in user configuration file (see the section called \(lqFILES\(rq)\&. .SH "EXAMPLES" -.SS "Album queue mode\&." +.SS "File tags queue mode (offline mode)\&." .PP -Here is an example of album queue configuration\&. +Here is an example of autoqueue using file tags only\&. +.sp +.if n \{\ +.RS 4 +.\} +.nf +[MPD] +host=example\&.org +port=6601 + +[sima] +# Setup internal plugins +internal = Tags, Crop +history_duration=48 # 2 days +queue_length=2 + +[tags] +# Look for files with tagged with genre "electonica" OR "IDM" OR "glitch" +genre = electonica, IDM, glitch + +[crop] +# keep 30 played tracks in playlist +consume=30 + + +.fi +.if n \{\ +.RE +.\} +.SS "Album queue mode using last\&.fm recommendations (online mode)\&." +.PP +Here is an example of album queue configuration using online recommendations system\&. .sp .if n \{\ .RS 4 @@ -181,9 +212,7 @@ will queue a track at random if other plugins did not return any tracks\&. .br .sp -You can add here as many plugins you want, currently shipping -\fBLastfm\fR -only\&. +You can add, combine here as many plugins you want\&. .br The priority may be used to order them\&. @@ -377,9 +406,64 @@ If set to "false", caching is still done but in memory\&. .RS 4 Plugin priority .RE +.SS "Tags section" +.PP +Tags plugin\*(Aqs configuration\&. There is no default configuration for this plugin, it does not work out of the box\&. +.PP +This plugin permits offline autoqueuing based on files tags only\&. Supported tags are +\fB\*(Aqcomment\*(Aq\fR, +\fB\*(Aqdate\*(Aq\fR, +\fB\*(Aqgenre\*(Aq\fR, +\fB\*(Aqlabel\*(Aq\fR +and +\fB\*(Aqoriginaldate\*(Aq\fR\&. It currently supports single track queuing only, no album mode for this plugin\&. +.PP +In addition to supported tags above you can use an MPD filter\&. Please refer to MPD protocol documentation for more\&. +.PP +All entries in this section are ANDed as a single MPD filter to look for titles in the library\&. Moreover, with tags, comma separated values are also ANDed\&. +.br + +For instance setting "\fBgenre=rock\fR" and "\fBdate=1982,1983,1984,1985,1986,1987,1988,1989\fR" will end up looking for track tagged with genre +\fBrock\fR +and date within 1985 through 1990\&. +.br + +Using an MPD filter to replace +\fBdate\fR +you can achieve the same with the following setting: "\fBgenre=rock\fR" and "\fBfilter=(date =~ \*(Aq198[2\-9]\*(Aq)\fR" (provided your MPD server was compiled with libpcre)\&. +.PP +\fB[tags]\fR +.RS 4 +.RE +.PP +\fBfilter=\fR +.RS 4 +You can use here any valid MPD filter as defined in MPD protocol documentation\&. +.RE +.PP +\fBcomment=\fR +.RS 4 +.RE +.PP +\fBdate=\fR +.RS 4 +.RE +.PP +\fBgenre=\fR +.RS 4 +.RE +.PP +\fBlabel=\fR +.RS 4 +.RE +.PP +\fBpriority=\fR\fI80\fR +.RS 4 +Plugin priority +.RE .SH "QUEUE MODES" .PP -mpd\-sima offers different queue modes\&. All of them pick up tracks from artists similar to the last track in the queue\&. +mpd\-sima offers different queue modes with lastfm plugin\&. All of them pick up tracks from artists similar to the last track in the queue\&. .PP mpd\-sima tries preferably to chose among unplayed artists or at least not recently played artist\&. Concerning track and album queue modes titles are chosen purely at random among unplayed tracks\&. .PP diff --git a/data/man/mpd_sima.cfg.5.xml b/data/man/mpd_sima.cfg.5.xml index 678e4de..8ff9db0 100644 --- a/data/man/mpd_sima.cfg.5.xml +++ b/data/man/mpd_sima.cfg.5.xml @@ -75,9 +75,15 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ --> + + File tags queue mode (offline mode). + Here is an example of autoqueue using file tags only. + + + - Album queue mode. - Here is an example of album queue configuration. + Album queue mode using last.fm recommendations (online mode). + Here is an example of album queue configuration using online recommendations system. @@ -206,8 +212,7 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ is an utility plugin, it does not queue any tracks (cf. below). will queue a track at random if other plugins did not return any tracks. - You can add here as many plugins you want, - currently shipping only. + You can add, combine here as many plugins you want. The priority may be used to order them. @@ -414,10 +419,63 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ + + Tags section + Tags plugin's configuration. There is no default configuration for this plugin, it does not work out of the box. + + This plugin permits offline autoqueuing based on files tags only. Supported tags are + , , , and + . It currently supports single track queuing only, no album mode for this plugin. + + + In addition to supported tags above you can use an MPD filter. Please refer to MPD protocol documentation for more. + + + All entries in this section are ANDed as a single MPD filter to look for titles + in the library. Moreover, with tags, comma separated values are also ANDed. + For instance setting "" and + "" + will end up looking for track tagged with genre + and date within 1985 through 1990. + Using an MPD filter to replace you can achieve + the same with the following setting: "" and + "" (provided your MPD server + was compiled with libpcre). + + + + + + + + You can use here any valid MPD filter as defined in MPD protocol documentation. + + + + + + + + + + + + + + + + 80 + + + Plugin priority + + + + QUEUE MODES - &dhpackage; offers different queue modes. All of them pick up + &dhpackage; offers different queue modes with lastfm plugin. All of them pick up tracks from artists similar to the last track in the queue. &dhpackage; tries preferably to chose among unplayed artists or at least not recently played artist. Concerning track and album @@ -467,3 +525,5 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ + diff --git a/doc/Changelog b/doc/Changelog index 3504aa3..f4aaa7d 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,5 +1,6 @@ MPD_sima v0.16.0 + * New offline autoqueue plugin based on file tags only * Update vinstall.py (closes #34) * Fixed bug when http client fetches a corrupted cached entry (closes #35) * Need at least python 3.6 diff --git a/doc/examples/all_settings.cfg b/doc/examples/all_settings.cfg index 2551f34..7b8e685 100644 --- a/doc/examples/all_settings.cfg +++ b/doc/examples/all_settings.cfg @@ -120,6 +120,26 @@ single_disable_queue = True ######################### PLUGINS ##################################### +[tags] +## Offline tags queing +# This plugin has no defaults set + +# TAGS, any of the supported tags below +# type: string +# default: not set +# description: +comment= +date= +genre= +label= +originaldate= + +# FILTER +# type: string +# default: not set +# description: Forge your own MPD filter (cf MPD protocol documentation) +filter= + [crop] ## CONSUME # type: integer diff --git a/sima/utils/config.py b/sima/utils/config.py index c9240ea..20356a1 100644 --- a/sima/utils/config.py +++ b/sima/utils/config.py @@ -87,6 +87,14 @@ DEFAULT_CONF = { 'track_to_add': 1, 'priority': 50, }, + 'tags': { + 'comment': "", + 'date': "", + 'genre': "", + 'label': "", + 'originaldate': "", + 'priority': 80, + } } # -- 2.39.2