6 playlists
Anna Schumaker edited this page 2023-05-10 16:33:09 -04:00

The playlists table holds information for user and system playlists.

Columns

Name Type Description
playlistid INTEGER The unique id of a singe playlist
propertyid INTEGER The rowid of this playlist's properties
name TEXT The name of this playlist
image PATH The filepath of an image to display in the UI

Triggers

Name When Description
playlists_insert_trigger After insert Create a new row in the playlist_properties table
playlists_delete_trigger After delete Delete this playlist's entry in the playlist_properties table
collection_loop_trigger Before update Prohibit setting loop to "None" on the Collection playlist
previous_loop_trigger Before update Prohibit setting loop to anything other than "None" on the Previous playlist
previous_shuffle_trigger Before update Prohibit setting shuffle to TRUE on the Previous playlist
previous_sort_order_trigger Before update Prohibit setting the sort order on the Previous playlist

The playlists_view

The playlists_view joins the playlists table with the playlist_properties table so the application can use one query to access all the relevant state for each playlist.

Column Description
playlistid The playlistid of this playlist
propertyid The rowid of the playlist_properties for this playlist
name The name of this playlist
image The filepath of an image to display for this playlist
active The active state of this playlist
loop The loop state of this playlist
shuffle The shuffle state of this playlist
sort_order The sort order of this playlist
current_trackid The current track of this playlist

Track Views

These other views are used to select tracks that belong to each of the default playlists. The only column they have to select is the trackid, and are used to filter out tracks that are being deleted.

View Name Description
collection_view Tracks where the associated library is enabled
favorite_view Tracks where tracks.favorite is TRUE
most_played_view Tracks where tracks.playcount is greater than the average playcount (rounded up)
new_tracks_view Tracks where tracks.added is a date within the last 7 days
unplayed_tracks_view Tracks where tracks.playcount is 0

Default System Playlists

Name Track View Destription
Collection collection_view A playlist containing all tracks added to the database
Favorite Tracks favorite_view A playlist containing the user's favorite tracks
Most Played Tracks most_played_view A playlist containing tracks with an above-average playcount
New Tracks new_tracks_view A playlist containing recently added tracks
Previous Tracks system_tracks_view A playlist containing recently played tracks
Queued Tracks user_tracks_view A playlist containing tracks that will be played soon
Unplayed Tracks unplayed_tracks_view A playlist containing tracks that have not been played yet