funkwhale/docs/specs/playlist-library-federation/index.md

2.3 KiB

Playlist libraries to share audio files

The Issue

  • Has a user I want to share a list of tracks privately to mmy friends
  • Has a user I want to have a single container to curate my content (not playlist and libraries, only playlists)

Proposed Solution

The users can request access to the playlist content to the playlist owner

Feature Behavior

Users will be able to click on a "Request access to playlist audios files" button. This is a LibraryFollow request of the playlist.library. Not to be confused with the playlist follow request (see #-followup)

Backend

Data model

Playlist one_to_one with Library through library field Upload many_to_one with Library through library (reverse is library.uploads) Upload has also a many_to_many with Library through playlist_libraries (the same upload can be share various time in through various playlists). Reverse relation is library.playlist_uploads

Federation

Since Playlist is the main object here, we use the Playlist activities to send the Library information on ActivitiPub. There is no other reason to share the playlit.library to remote.

Migrations
  1. Remote library are not changed
  2. Local lib are not deleted but are assigned to a playlist
  3. Libraries Follows are not touched
  4. Remote want fetch local libs as always but they will need to update the data or fail (migrating uploads from library to playlist_library)
Done
  • PlaylistViewSet add clear remove update the uploads.playlist_libraries relationships
  • PlaylistViewSet add clear remove -> schedule_scan -> Update activity to remote -> playlist.library scan on remote
  • library and playlist scan delay are long (24h), force on ap update
  • make sure only owned upload are added to the playlist.library
  • update the "drop library" migrations to use the playlist.library instead of user follow
  • make sure user get the new libraries created after library drop
  • update the federation api to send the playlist_library info

Follow up

  • Add the frontend playlist button in the new ui
  • Finish library drop (delete libraries endpoints)
  • Playlist discovery : fetch federation endpoint for playlists
  • Playlist discovery : add the playlist to my playlist collection = follow request to playlist