A common #smarterplaylists feature request has been to filter playlists by the relative date in which a track was added to the playlist. Relative date filtering would allow you to do things like extract all the tracks in my “favs playlist” that have been added in the last six months. Using a relative date like ‘six months ago’ versus an absolute date like ‘August 21, 2015’ makes it possible to write a #smarterplaylists program that will continue to surface up the tracks from the most recent six months, no matter how far in the future it is run.
This weekend, I’ve added support for a Playlist (Rel Date) component that will filter playlists by the relative date added. Here’s an example configuration for the component:
Relative dates are given as you would say them. Some examples of the type of relative dates supported are:
- 1 month
- 2 days 2 hours
- 3 years 2 months 2 days
- 3 years 2 months and 2 days ago
- 3 years, 2 months and 22 days ago!
- 1 h 3 w 2 d
- last week
- last month
- last year and three weeks ago
- six weeks
- a week ago
- twenty days ago
- 6 mnths, 2 wks
Keeping it Fresh
Here’s an example of how we can use the relative date filter to help us keep a periodically updating playlist filled with fresh tracks.
Here’s my Gothic Metal sampler. It collects songs from a number of gothic metal playlists, selects songs at random and adds them to a playlist called Gothic Metal Sampler:
This program is scheduled to run once a day, giving me a fresh playlist of gothic metal to listen to on my morning commute. Unfortunately, the playlist isn’t always so fresh. There’s nothing to prevent the same songs from appearing over and over. We are relying totally on the throw of the virtual dice to keep the playlist fresh.
With the new relative date support, this is very easy to fix. The idea is to simultaneously update a separate archive playlist that keeps track of all the songs that have been ever added to my gothic metal sampler. I can then use the new relative date support to extract all the tracks that have been added to that playlist in the last week and use that set of tracks as input to the mixer track filter which will ensure that those tracks will not be included in the output. The result is that the Gothic Metal Sampler is updated every day while no song will appear more frequently than once a week in the playlist.
Feel free to import the program for study and use.
Using the relative date filtering in this fashion is a pretty handy way for you to incorporate history into your programs.