Page 1 of 1

Playlist based on albums not played or not played recently

Posted: Sun Nov 23, 2008 1:06 pm
by palmernet
I would like to create a playlist contains songs from albums I haven't listed to in my collection since I migrated to Media Monkey.

I can obtain a list fairly easily using Microsoft Access and ODBC with this query:
SELECT TOP 100 Albums.Artist, Albums.Album, Songs.ID, Songs.TrackNumber, Songs.SongTitle, Songs.SongPath, Songs.Year
FROM Songs INNER JOIN Albums ON Songs.IDAlbum = Albums.ID
WHERE (((Exists (SELECT 'X' FROM Songs WHERE Albums.ID=Songs.IDAlbum and LastTimePlayed>0))=False));


Is there are way to create a playlist from an SQL query?

Re: Playlist based on albums not played or not played recently

Posted: Sun Nov 23, 2008 1:29 pm
by nynaevelan
You can use Bex's SQL Viewer script for this. Here are some examples he gave me for something else, but they should get you started on your way.

Code: Select all

SELECT IDPlaylist, PlaylistName FROM Playlists WHERE PlaylistName = 'playlistname goes here'
Note the id for future use.

Construct your sql which finds the songs you want to put in the playlists.
When you then want to add the songs to your playlist you need to construct the SELECT-statement like this:

Code: Select all

SELECT ThePlaylistIdHere, Songs.ID FROM songs WHERE bla bla bla
To actually add the songs do like this:

Code: Select all

INSERT INTO Playlists (IDPlaylist, IDSong) SELECT ThePlaylistIdHere, Songs.ID FROM songs WHERE bla bla bla
To remove the songs from your playlist before you add new ones, either do it manually in MM or run this sql:

Code: Select all

DELETE FROM Playlists WHERE IDPlaylist = ThePlaylistIdHere
Nyn

Re: Playlist based on albums not played or not played recently

Posted: Mon Nov 24, 2008 6:39 am
by palmernet
This script is good - but how do I turn it into a auto-playlist?