musicat icon indicating copy to clipboard operation
musicat copied to clipboard

feat: use file-based smart playlists

Open daiyam opened this issue 10 months ago • 2 comments

This PR replaces the smart playlists in the database with file-based ones. The format is DynoPL which I wrote.

!!! Warning!!! On the boot, the smart playlists in the db are automatically converted to files. You might want to comment the line await db.smartQueries.delete(smartQuery.id);

Please let me know what you think.

daiyam avatar Feb 26 '25 09:02 daiyam

Wow! Man, this is great and seems so versatile. So much to dig into though, give me some time to gather my thoughts. On first glance:

  • I like that the playlists are just stored as regular files next to the regular playlists, for the same reasons I moved the regular playlists to M3Us:
      1. peace of mind - I know that they are just files in a folder, rather than in some internal database. Gives me more sense of ownership.
      1. As a developer I don't have to worry about losing playlists if I wipe the database for testing purposes (which I do a lot!).

A couple of issues I noticed when playing around:

  • Rule types don't get recognized: Property 'is' does not exist on type 'Rule'.
  • Renaming the playlist doesn't seem to work

basharovV avatar Mar 07 '25 22:03 basharovV

  • Rule types don't get recognized: Property 'is' does not exist on type 'Rule'.

Yes, I don't know why the union isn't correctly detected.

  • Renaming the playlist doesn't seem to work

Yes, I wanted to have your feedback before moving forward. Also, I've just implemented what's the current smart playlist can do. I didn't added new features since I think a true sql db would be more easier to use. (Just generate a sql query from the rules, then simply execute it)

daiyam avatar Mar 07 '25 22:03 daiyam