Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playlists support #14

Closed
christophehenry opened this issue Oct 9, 2016 · 12 comments
Closed

Playlists support #14

christophehenry opened this issue Oct 9, 2016 · 12 comments

Comments

@christophehenry
Copy link

I open this issue to discuss the working of playlists. My proposition follows.

DB model

  1. a playlist belongs to one and only one user,
  2. a user has zero or more playlists,
  3. a playlist contains zero or more ordered videos,
  4. a video belongs to zero or more playlists (maybe not?)
  5. a playlist has only one name,
  6. a playlist has only one creation date,
  7. a playlist has only one update date (maybe not?)

API routes

  1. get /playlist/:id: get informations about playlist (author, name, creation date, etc.)
  2. delete /playlist/:id suppress a playlist
  3. get /playlist/:id/videos: get videos in the playlist
  4. put /playlist/:id/video/:id: add a video to the playlist
  5. delete /playlist/:id/video/:id: remove a video from the playlist
  6. patch /playlist/:id/name/:name: rename the playlist

We need to discuss about reordering the playlist, too.

@Chocobozzz
Copy link
Owner

Chocobozzz commented Oct 9, 2016

For the DB model, I would add a playlist visibility: public/private.

I like the reordering API of Spotify: https://developer.spotify.com/web-api/reorder-playlists-tracks/

My opinion:

  • A playlist belongs to one user so I would prefix each route with /users/userId/.
  • playlist -> playlists to keep coherency
  • Add a video to the playlist throught the POST method and body parameters
  • Suppress a video from the playlist throught the DELETE method and body parameters
  • Rename a playlist is part of the modify playlist route

API route

  1. get /accounts/:accountId/playlists/ → get account playlists
  2. get /video-channels/:videoChannelId/playlists/ → get video channel playlists (to organize videos inside the channel)
  3. get /playlists/:id → get playlist information (+ number of videos)
  4. delete /playlists/:id → suppress a playlist
  5. get /playlists/:id/videos → get videos of the playlist
  6. post /playlists/:id/videos → add video(s) to the playlist
  7. put /playlists/:id/videos → reorder playlist
  8. delete /playlists/:id/videos/:id → delete video from the playlist
  9. put /playlists/:id → change playlist informations (name, visibility?)

Account playlists: just playlists that could be accessed and shared (if public)
Video channel playlists: playlists to organize videos inside a channel

Database schema

#14 (comment)

@christophehenry
Copy link
Author

christophehenry commented Oct 9, 2016

I would use PATCH to reorder the playlists and change informations as it is it's definition:

The PATCH method applies partial modifications to a resource.

@Chocobozzz
Copy link
Owner

Chocobozzz commented Jan 13, 2017

Now we use a relational DBMS, the database scheme is changed.

My proposal:

playlistTable:
  {
    name: String,
    description: String,
    visibility: {
      type: String,
      enum: ['PUBLIC', 'PRIVATE']
    },
    createdAt: {
      type: Date,
      default: Date.now
    },
    updatedAt: {
      type: Date,
      default: Date.now
    },
    actorId -> references the actor that owns the playlist
  }

playlistVideoTable:
  {
    // Position of the video in the playlist
    position: {
      type: Number,
      default: 0
    },
    videoId -> references a video
    playlistId -> references a playlist
  }

@DimitriGilbert
Copy link
Contributor

I was wondering about channel's playlist (or even playlists for videos like what is hacked here https://youtu.be/5NJSCRPeNpU?t=11m0s the annotation link bottom rigth of the video)
For this reason I suggest to replace userId by something like ownerId and ownerType. It would make the playlist system very versatile at a very reasonnable cost (the GUI for it could come later but everything would be in place for it to work in the future)

@Chocobozzz
Copy link
Owner

I updated my comment to replace userId by actorId. An actor is a user or a channel.

@DimitriGilbert
Copy link
Contributor

works for me :)

@6543
Copy link

6543 commented Feb 28, 2019

Any progress at the moment?

@Chocobozzz
Copy link
Owner

@6543 https://github.com/Chocobozzz/PeerTube/tree/feature/playlists

@Chocobozzz
Copy link
Owner

Implemented in #1708

@6543
Copy link

6543 commented Mar 26, 2019

Tanks for the great work!

@rzr
Copy link

rzr commented May 13, 2019

is this feature released in any version ? Apparently not in current version:

https://github.com/Chocobozzz/PeerTube/releases/tag/v1.2.1

@6543
Copy link

6543 commented May 15, 2019

@rzr Pre-Release v1.3.0-rc.1

@Chocobozzz Chocobozzz removed their assignment May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants