Reply To: Inteligent playlists

#7571
riro
Participant

OK… a few steps on the way…

This code will create a table, populate it with last played-info from the songs-table. And then create a view that has a formated date and time-column.


CREATE TABLE playlistlog (
id INTEGER NOT NULL,
time_played INTEGER
);

INSERT INTO playlistlog SELECT id, time_played FROM songs where time_played > 0;

CREATE VIEW formatedlog AS
SELECT songs.path AS path, time(playlistlog.time_played, 'unixepoch') AS play_time, date(playlistlog.time_played, 'unixepoch') AS play_date
FROM playlistlog, songs
WHERE songs.id = playlistlog.id;

With that in place you can create a query like:


SELECT path
FROM formatedlog
WHERE play_time > '18:00:00' AND play_time < '18:30:00';

And you will get a list (with filename) of songs played between 18:00 and 18:30.

Next step… create a view with songs played more than one time in that time-frame.