Reply To: Limit smart playlists ?

#7919
rpedde
Participant

@riro wrote:

@rpedde wrote:

Oh, yeah… like that it’s doable. In fact, there’s no reason you could dummy up static playlists right in the database itself using sql queries (those are playlist type 0).

After a “few” days on the road Im back…

Did a few attempts to figure it out, but no luck.

What columns (any specific name/order) do you need to return from the query?

First, make your playlist:

[email protected]:~$ sqlite /path/to/songs.db
sqlite> insert into playlists (title,type,items,db_timestamp,idx) values (‘Recent Adds’,0,100,0,0);
sqlite> select last_insert_rowid();
154
sqlite> insert into playlistitems select NULL,154,id from songs order by time_added desc limit 100;

Note that once you have the id (154), you can just do the insert line. Or maybe your nightly cron job would do


delete from playlist items where playlistid=154; insert into playlistitems ...

Ooh. Except I just noticed a full rescan deletes those. I’ll fix that for next nightly.

— Ron