Listening history examples¶
These examples use the calliope.lastfm.history
module to query stored
plays from Last.fm.
You should first create a ~/.config/calliope/calliope.conf
file specifying
your last.fm username. For example:
[lastfm]
user=bbc6music
Artists which you discovered this year¶
# Artists which you discovered in the last year.
#
# You may want to add `--min-listens=3` to filter out things you only played
# once or twice.
cpe lastfm-history artists --first-play-since='1 year ago'
Music which you haven’t listened to for over a year¶
# Music which you haven't listened to this year.
#
# We filter out things that you never listened to much (less than 5 times
# total).
cpe_local_database=${cpe_local_database-cpe tracker}
duration=${duration-1hour}
cpe lastfm-history tracks --last-play-before='1 year ago' --min-listens=5 | \
cpe shuffle - | head -n 100 | \
$cpe_local_database resolve-content - | \
cpe select --constraint=type:playlist-duration,vmin:$duration,vmax:$duration - | \
cpe export -
If you want to listen to this playlist, resolve the tracks using your local music collection, for example:
examples/listen_history/not-listened-this-year.sh | cpe tracker resolve-content - | cpe export -
Music which you’ve never listened to¶
# A playlist of music that you've never listened to.
cpe diff <(cpe tracker tracks) <(cpe lastfm-history tracks) | cpe export -
Music which you’ve listened to but don’t own¶
# Music that you've listened to but isn't in your local collection.
cpe_local_database=${cpe_local_database-cpe tracker}
cpe diff <(cpe lastfm-history tracks --min-listens 4) <($cpe_local_database tracks)