Documentation
¶
Overview ¶
Package playlists manages per-user ordered collections of torrent references. A playlist contains items that reference a magnet + info_hash; resume state lives in the library package so the same content played from search vs. playlist shares its watched position.
Index ¶
- type Item
- type Playlist
- type Store
- func (s *Store) AddItem(playlistID, userID int, item Item, includeAll bool) (*Item, error)
- func (s *Store) Create(userID int, name, description string) (*Playlist, error)
- func (s *Store) Delete(id, userID int, includeAll bool) error
- func (s *Store) Get(id, userID int, includeAll bool) (*Playlist, error)
- func (s *Store) Items(playlistID, userID int, includeAll bool) ([]Item, error)
- func (s *Store) List(userID int, includeAll bool) ([]Playlist, error)
- func (s *Store) RemoveItem(playlistID, itemID, userID int, includeAll bool) error
- func (s *Store) Reorder(playlistID, itemID, userID, newPos int, includeAll bool) error
- func (s *Store) Update(id, userID int, name, description string, includeAll bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct {
ID int `json:"id"`
PlaylistID int `json:"playlistId"`
Position int `json:"position"`
LibraryID *int `json:"libraryId,omitempty"`
Title string `json:"title"`
Magnet string `json:"magnet"`
InfoHash string `json:"infoHash"`
FileIndex int `json:"fileIndex"`
AddedAt time.Time `json:"addedAt"`
}
Item is one position in a playlist.
type Playlist ¶
type Playlist struct {
ID int `json:"id"`
UserID int `json:"userId"`
Name string `json:"name"`
Description string `json:"description"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
ItemCount int `json:"itemCount,omitempty"` // populated by List, not Get
}
Playlist is one user-owned ordered collection.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func New ¶
New wires the playlists store onto the shared Postgres pool. Schema is applied centrally (internal/db migrations).
func (*Store) List ¶
List returns the user's playlists (or all when includeAll=true), with item counts.
func (*Store) RemoveItem ¶
RemoveItem deletes an item and compacts positions.
Click to show internal directories.
Click to hide internal directories.