<option>top</option> and <option>track</option>
queue modes. This is actually an upper limit,
min(<option>max_art</option>,
- <option>track_to_add</option>) will be used, and
- <option>max_art</option> might be inferior lower
- than value set in config.</para>
+ <option>track_to_add</option>) will be used.</para>
</listitem>
</varlistentry>
<varlistentry> <!-- lastfm.album_to_add -->
<option>album</option> queue modes.</para>
</listitem>
</varlistentry>
+ <varlistentry> <!-- lastfm.track_to_add_from_album -->
+ <term><option>track_to_add_from_album=</option><replaceable>0</replaceable></term>
+ <listitem>
+ <para>How many track(s) to add from each selected albums. Only relevant in
+ <option>album</option> queue modes. When set to 0 or lower the whole album is queued.
+ </para>
+ </listitem>
+ </varlistentry>
<varlistentry> <!-- lastfm.cache -->
<term><option>cache=</option><replaceable>True</replaceable></term>
<listitem>
* Fixed sqlite sqlite3.OperationalError VACUUM Error
cf. https://bugs.python.org/issue28518
+ * Add option to queue a chosen number of tracks from an album (closes #28)
+ * Add option to shuffle tracks in album mode (Thanks Sacha)
-- kaliko jack <kaliko@azylum.org>
# description: how many albums the plugin will try to get
album_to_add = 1
+## TRACK_TO_ADD_FROM_ALBUM
+# type: integer
+# scope: "album" queue mode
+# description: how many tracks from one album the plugin will try to get
+# defaults to 0 to queue the whole album
+track_to_add_from_album = 0
+
+## SHUFFLE_ALBUM
+# type: boolean
+# scope: "album" queue mode
+# description: should the tracks of the album be shuffled
+shuffle_album = false
+
## CACHE
# type: boolean
# description: whether or not to use on-disk persistent http cache
# -*- coding: utf-8 -*-
-# Copyright (c) 2009-2015 Jack Kaliko <kaliko@azylum.org>
+# Copyright (c) 2009-2019 Jack Kaliko <kaliko@azylum.org>
+# Copyright (c) 2019 sacha <sachahony@gmail.com>
#
# This file is part of sima
#
continue
self.log.info('%s album candidate: %s - %s', self.ws.name, artist, album_to_queue)
nb_album_add += 1
- self.to_add.extend(self.player.find_album(artist, album_to_queue))
+ candidates = self.player.find_album(artist, album_to_queue)
+ if self.plugin_conf.getboolean('shuffle_album'):
+ random.shuffle(candidates)
+ # this allows to select a maximum number of track from the album
+ # a value of 0 (default) means keep all
+ nbtracks = self.plugin_conf.getint('track_to_add_from_album')
+ if nbtracks > 0:
+ candidates = candidates[0:nbtracks]
+ self.to_add.extend(candidates)
if nb_album_add == target_album_to_add:
return True
# -*- coding: utf-8 -*-
-# Copyright (c) 2009, 2010, 2011, 2013, 2014, 2015 Jack Kaliko <kaliko@azylum.org>
+# Copyright (c) 2009, 2010, 2011, 2013, 2014, 2015, 2019 Jack Kaliko <kaliko@azylum.org>
+# Copyright (c) 2019 sacha <sachahony@gmail.com>
#
# This file is part of sima
#
'single_disable_queue': "true",
'mopidy_compat': "false",
},
- 'daemon':{
+ 'daemon': {
'daemon': False,
'pidfile': "",
},
'priority': 0,
},
'lastfm': {
- 'queue_mode': "track", #TODO control values
+ 'queue_mode': "track", # TODO control values
'max_art': 10,
'single_album': "false",
'track_to_add': 1,
'album_to_add': 1,
+ 'shuffle_album': False,
+ 'track_to_add_from_album': 0, # <=0 means keep all
'depth': 1,
'cache': True,
'priority': 100,
},
'random': {
- 'flavour': "sensible", # in pure, sensible
+ 'flavour': "sensible", # in pure, sensible
'track_to_add': 1,
'priority': 50,
},