Skip to content

Instantly share code, notes, and snippets.

@electricessence
Created July 21, 2015 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save electricessence/5c10590e9c53aa4da95d to your computer and use it in GitHub Desktop.
Save electricessence/5c10590e9c53aa4da95d to your computer and use it in GitHub Desktop.
This SQL script is used with Magic Nodes on MediaMonkey to filter out songs that have already been played recently, but also artists and albums.
Songs.ID IN (SELECT ID FROM Songs WHERE Songs.ID IN ( SELECT ID FROM Songs WHERE <Custom 2> NOT LIKE 'Retire%' AND <Custom 2> NOT LIKE 'Duplicate%' AND Rating >= 60 AND ( <Played> < 1 AND <Days since last played> > 1 OR LastTimePlayed = 0.0 OR <Days since last played> > (<Played> * <Played> + 7 + 100-<Rating> ) ) AND Songs.Artist IN ( SELECT Artist FROM Songs GROUP BY Artist HAVING Max(LastTimePlayed) = 0.0 OR JulianDay( Date('now', 'localtime') ) - JulianDay( Date(Max(LastTimePlayed) + JulianDay('1899-12-30')) ) > 7 ) AND ( Songs.Album = "" OR Songs.IDAlbum IN ( SELECT IDAlbum FROM Songs GROUP BY IDAlbum HAVING Max(LastTimePlayed) = 0.0 OR JulianDay( Date('now', 'localtime') ) - JulianDay( Date(Max(LastTimePlayed) + JulianDay('1899-12-30')) ) > 2 ) ) GROUP BY IDAlbum ORDER BY (<Played> - 2*<Year> - <Rating>/20)) GROUP BY Artist)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment