Python MPD client with integrated Last.FM support
suggestive
required python 3.5 or higher. Also, you'll probably want a
Last.FM scrobbler to make use of the album ordering features. I personally
prefer mpdscribble, but
whatever floats your boat.
$ git clone https://github.com/thesquelched/suggestive.git
$ cd suggestive
$ python3 setup.py install
$ suggestive -h
usage: suggestive [-h] [--log LOG] [--config CONFIG] [--update] [--no_update]
[--reinitialize-scrobbles]
Suggestive
optional arguments:
-h, --help show this help message and exit
--log LOG, -l LOG Log file path
--config CONFIG, -c CONFIG
Config file path
--update, -u Update database
--no_update, -U Do not update database
--reinitialize-scrobbles
Re-initialize scrobbles from LastFM
suggestive
looks for a configuration file in the following places (in-order):
$HOME/.suggestive.conf
/etc/suggestive.conf
You can also force a certain config path using the -c
option. Before you can
run suggestive
, you must supply two pieces of information: your Last.FM
username and a Last.FM API key. You can sign up for an API key
here.
Here is a minimal suggestive
configuration file:
[lastfm]
user = my_lastfm_user
api_key = 0123456789abcdefghijklmnopqrstuv
api_secret = 141iojhu789uihy78uiho9uih89080
A sample configuration file is available.
suggestive
uses vim-like keybindings.
q
,<C-c>
- Quit:
- Enter command modeu
- Update mpdU
- Forcesuggestive
database updatep
- Pause/resume playback<C-w>
- Switch between open buffersr
- Reload library (useful to recalculate album order)L
- Toggle track loved status
h
,arrow-left
- Leftj
,arrow-down
- Downk
,arrow-up
- Upl
,arrow-right
- Right<C-f>
,page-down
- Scroll one page down<C-b>
,page-up
- Scroll one page upg
,home
- Go to topG
,end
- Go to bottom
/
- Search forward?
- Search backwardn
- Next search resultN
- Previous search result
space
- Enqueue album/trackenter
- Play album/trackz
- Toggle tracks fold (i.e. toggle album tracks display)i
- Toggle ignored (ignored tracks always appear at the bottom of the library)
c
- Clear playlistd
- Remove trackenter
- Play trackm
- Enter move mode>
- Next track<
- Previous track
q
- quitplaylist
- toggle playlist bufferlibrary
- toggle library bufferorientation
- (Alias:or
) toggle between vertical and horizontal orientationsscore <show=bool>
- Toggle or set whether or not to show the ordering score in the library
seek <seconds>
- Seek the currently playing track to the given position. Ifseconds
begins with+
or-
, then seek to the given time relative to the present.
suggestive
tries to order your library so that albums you'd probably like to listen to are close to the top, while albums you don't like are towards the bottom. However, you can change what's displayed using one or more filters or orderers. Note that you can compose multiple filters/orderers by issuing succesive commands.
<ESC>
- Clear all filters/orderers, restoring the default ordering (may be disabled with thelibrary/esc_resets_orderers
config option):album <name>
- (Alias:al
) Only display albums matchingname
(case-insensitive):artist <name>
- (Alias:ar
) Only display albums of the artist matchingname
(case-insensitive):loved <min=0.0> <max=1.0> <reverse=false>
- (Alias:lo
) Display albums in order of fraction of tracks loved. You may optional specify the minimum or maximum fraction of loved tracks for an album to be displayed:modified <reverse=false>
- (Alias:mod
) Sort by file modification time, which can be useful for finding recently-downloaded albums:playcount <min=0.0> <max=None> <reverse=false>
- (Alias:pc
) Display albums in order of fractional playcount (i.e. number of scrobbles / number of tracks). Note that this number can be greater than 1 tracks from the library:sort <reverse=false>
- Sort albums using the string 'artist - album':reset
- Reset library order to default:unorder
- Remove all orderings (Alias:unordered
)
suggestive
provides the capability of sorting your library with one or more filters or "orderers". It assigns a simple ranking to albums according to the orderers you have specified, with higher ranked albums at the top. The default ordering gives higher weight to albums with more loved tracks, as well as those with a higher fractional playcount. These orderers work in concert, so an album with many loved tracks might be ranked similarly to one that has been played many times, but lower to one that has both. The available orderer commands are album
, artist
, loved
, playcount
, sort
, and modified
. See the library commands section for more information.
Either hitting esc
or using the :reset
command will reset the orderers back to the default, which is loved; playcount
. You can change the default in your config file using the library.default_order
option. The format is just a semicolor-separated list of orderer commands, without the preceding colon. For example, this sets the default ordering to modification date in reverse order:
[library]
default_order = modified reverse=true
If you wish to work from scratch with no ordering, use the :unorder
command.
You can combine one or more order commands to create your own custom orderer commands. This can be done in your config file, similarly to setting a default orderer; see the example config file for more information.
Here's an example that creates a command mycommand
that uses the loved
and
playcount
orderers:
[custom_orderers]
mycommand = unorder; loved max=0; playcount
mycommand
will then be accessible from command mode in the library buffer,
just like any other orderer.
Although I am using suggestive
as my full-time MPD client, it's still
somewhat early in development, and you might encounter some problems while
using it.
Sometimes, you can resolve an issue by deleting/renaming the suggestive
database file ($HOME/.suggestive/music.db
by default), and then re-running
suggestive, which will rebuild the database. If this does not resolve the
problem, please open up a GitHub issue.
I use alembic
to generate migrations for suggestive
's internal sqlite
database. To generate database migrations:
- Install the latest version of
suggestive
and run it at least once to migrate to the latest database version - Copy
alembic.ini.template
toalembic.ini
- Replace
<INSERT SUGGESTIVE DB PATH HERE>
with the path to yoursuggestive
database, e.g./home/myuser/.suggestive/music.db
. - Make changes to the database model
- Create a new migration file:
alembic revision --autogenerate -m '<COMMIT MESSAGE>'