From 41e7f45be3c35a4630478211b2036ce496fdf588 Mon Sep 17 00:00:00 2001 From: kaliko Date: Tue, 21 Nov 2017 16:35:06 +0100 Subject: [PATCH] Add option to prevent single|repeat to disable queuing (Closes #19) --- data/man/mpd_sima.cfg.5 | 10 +++ data/man/mpd_sima.cfg.5.xml | 128 ++++++++++++++++++-------------- doc/Changelog | 1 + doc/examples/all_settings.cfg | 12 +++ sima/plugins/core/mpdoptions.py | 12 +-- sima/utils/config.py | 2 + 6 files changed, 103 insertions(+), 62 deletions(-) diff --git a/data/man/mpd_sima.cfg.5 b/data/man/mpd_sima.cfg.5 index b696d61..5d5aba6 100644 --- a/data/man/mpd_sima.cfg.5 +++ b/data/man/mpd_sima.cfg.5 @@ -212,6 +212,16 @@ Use MusicBrainzIdentifier to search music (mainly for artists)\&. Default is Tru Consider using these metadata as it enhances a lot artist/album/tracks identification\&. Use Picard to tag your file: \m[blue]\fB\%https://picard.musicbrainz.org/\fR\m[]\&. .RE +.PP +\fBrepeat_disable_queue=\fR\fItrue\fR +.RS 4 +Prevent disabling queuing in repeat play mode\&. +.RE +.PP +\fBsingle_disable_queue=\fR\fItrue\fR +.RS 4 +Prevent disabling queuing in single play mode\&. +.RE .SS "Crop section" .PP crop plugin\*(Aqs configuration: diff --git a/data/man/mpd_sima.cfg.5.xml b/data/man/mpd_sima.cfg.5.xml index 3f7172f..002b141 100644 --- a/data/man/mpd_sima.cfg.5.xml +++ b/data/man/mpd_sima.cfg.5.xml @@ -185,63 +185,77 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ - - - - - - - - - Lastfm, Random, Crop - - &dhpackage;'s plugin management for internal source plugin - and contrib (ie. external plugins). Plugins list is a - comma separated string list. Optional plugin's - configuration lays in its own section.For instance a - "AwesomePlugin" declared here gets its configuration from the - corresponding section "[awesomeplugin]". - - The default list of plugins to load at startup: ,,. - 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. - The priority may be used to order them. - - - - - 8 - - How far to look back in history to avoid to play - twice the same track/title (duration in - hours). - The is also used to give priority to not recently played artists. - - - - - 2 - - Threshold value triggering queue process. - - - - true - - Use MusicBrainzIdentifier to search music (mainly - for artists). - Default is True, switch to False if you don't have - MusicBrainzIdentifier set for at least 80% of you - music library. Consider using these metadata as it - enhances a lot artist/album/tracks identification. - Use Picard to tag your file: . - - - - + + + + + + + + + Lastfm, Random, Crop + + &dhpackage;'s plugin management for internal source plugin + and contrib (ie. external plugins). Plugins list is a + comma separated string list. Optional plugin's + configuration lays in its own section.For instance a + "AwesomePlugin" declared here gets its configuration from the + corresponding section "[awesomeplugin]". + + The default list of plugins to load at startup: ,,. + 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. + The priority may be used to order them. + + + + + 8 + + How far to look back in history to avoid to play + twice the same track/title (duration in + hours). + The is also used to give priority to not recently played artists. + + + + + 2 + + Threshold value triggering queue process. + + + + true + + Use MusicBrainzIdentifier to search music (mainly + for artists). + Default is True, switch to False if you don't have + MusicBrainzIdentifier set for at least 80% of you + music library. Consider using these metadata as it + enhances a lot artist/album/tracks identification. + Use Picard to tag your file: . + + + + + true + + Prevent disabling queuing in repeat play mode. + + + + + true + + Prevent disabling queuing in single play mode. + + + + diff --git a/doc/Changelog b/doc/Changelog index 8b5e7c3..9aa9442 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,7 @@ MPD_sima v0.15.0 * Remove EchoNest support (Closes #10) * Enhanced queuing behavior in random mode (Closes #16) + * Add option to prevent single & repeat mode to disable queuing (Closes #19) -- kaliko jack UNRELEASED diff --git a/doc/examples/all_settings.cfg b/doc/examples/all_settings.cfg index b0df17f..a720375 100644 --- a/doc/examples/all_settings.cfg +++ b/doc/examples/all_settings.cfg @@ -106,6 +106,18 @@ queue_length = 2 # description: Use of MusicBrainzIdentifier tag musicbrainzid = True +## REPEAT_DISABLE_QUEUE +# type: boolean +# default: True +# description: Prevent repeat play mode to disable queuing +repeat_disable_queue = True + +## SINGLE_DISABLE_QUEUE +# type: boolean +# default: True +# description: Prevent single play mode to disable queuing +single_disable_queue = True + ######################### PLUGINS ##################################### [crop] diff --git a/sima/plugins/core/mpdoptions.py b/sima/plugins/core/mpdoptions.py index fe368bd..47b0c04 100644 --- a/sima/plugins/core/mpdoptions.py +++ b/sima/plugins/core/mpdoptions.py @@ -18,7 +18,7 @@ # # """ - Deal with MPD options ‑ idle and repeat mode + Deal with MPD options ‑ single and repeat mode """ # standard library import @@ -44,11 +44,13 @@ class MpdOptions(Plugin): """ player = self.daemon.player if player.playmode.get('single'): - self.log.info('MPD "single" mode activated.') - self.daemon.enabled = False + if self.daemon.config.getboolean('sima', 'single_disable_queue'): + self.log.info('MPD "single" mode activated.') + self.daemon.enabled = False elif player.playmode.get('repeat'): - self.log.info('MPD "repeat" mode activated.') - self.daemon.enabled = False + if self.daemon.config.getboolean('sima', 'repeat_disable_queue'): + self.log.info('MPD "repeat" mode activated.') + self.daemon.enabled = False else: if self.daemon.enabled is False: self.log.debug('enabling queuing (leaving single|repeat mode)') diff --git a/sima/utils/config.py b/sima/utils/config.py index 0f13cba..dfa91e7 100644 --- a/sima/utils/config.py +++ b/sima/utils/config.py @@ -53,6 +53,8 @@ DEFAULT_CONF = { 'queue_length': 2, 'var_dir': 'empty', 'musicbrainzid': "true", + 'repeat_disable_queue': "true", + 'single_disable_queue': "true", }, 'daemon':{ 'daemon': False, -- 2.39.5