Documentation
¶
Overview ¶
Package peertube exposes a REST-client for PeerTube.
Index ¶
- type Account
- type Avatar
- type Banner
- type Category
- type Channel
- type Client
- func (c *Client) Account(ctx context.Context, name string) (Account, error)
- func (c *Client) Accounts(ctx context.Context) ([]Account, error)
- func (c *Client) Auth(ctx context.Context, usr, pwd string) error
- func (c *Client) Categories(ctx context.Context) ([]Category, error)
- func (c *Client) Channels(ctx context.Context, usr string) ([]Channel, error)
- func (c *Client) DelVideo(ctx context.Context, id string) error
- func (c *Client) Languages(ctx context.Context) ([]Language, error)
- func (c *Client) Licenses(ctx context.Context) ([]License, error)
- func (c *Client) Upload(ctx context.Context, vid VideoUpload) (Video, error)
- func (c *Client) UploadLegacy(ctx context.Context, vid VideoUpload) (Video, error)
- func (c *Client) UploadResumable(ctx context.Context, vid VideoUpload) (Video, error)
- func (c *Client) Video(ctx context.Context, id, pwd string) (Video, error)
- func (c *Client) Videos(ctx context.Context, usr string) iter.Seq2[Video, error]
- type Error
- type File
- type Language
- type License
- type Option
- type Privacy
- type PrivacyKind
- type Video
- type VideoFile
- type VideoResolution
- type VideoStreamingPlaylist
- type VideoUpload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
ID int `json:"id"`
UserID int `json:"userId"`
URL string `json:"url"`
Name string `json:"name"`
Host string `json:"host"`
Created time.Time `json:"createdAt"`
Updated time.Time `json:"updatedAt"`
HostRedundancyAllowed bool `json:"hostRedundancyAllowed"`
FollowingCount int `json:"followingCount"`
FollowersCount int `json:"followersCount"`
DisplayName string `json:"displayName"` // Editable name of the account, displayed in its representations
Description string `json:"description"` // Text or bio displayed on the account's profile
Avatars []Avatar `json:"avatars"`
Banners []Banner `json:"banners"`
}
Account describes an account on a remote peertube server.
type Avatar ¶
type Avatar struct {
Width int `json:"width"`
Path string `json:"path"`
Created time.Time `json:"createdAt"`
Updated time.Time `json:"updatedAt"`
}
Avatar describes an avatar on a remote peertube server.
type Banner ¶
type Banner struct {
Width int `json:"width"`
Path string `json:"path"`
Created time.Time `json:"createdAt"`
Updated time.Time `json:"updatedAt"`
}
Banner describes a banner on a remote peertube server.
type Channel ¶
type Channel struct {
ID int `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
Host string `json:"host"`
Created time.Time `json:"createdAt"`
Updated time.Time `json:"updatedAt"`
Owner Account `json:"ownerAccount"`
Avatars []Avatar `json:"avatars"`
HostRedundancyAllowed bool `json:"hostRedundancyAllowed"`
FollowingCount int `json:"followingCount"`
FollowersCount int `json:"followersCount"`
Banners []Banner `json:"banners"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
Support string `json:"support"`
IsLocal bool `json:"isLocal"`
}
Channel describes an account's channel on a remote peertube server.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a PeerTube client.
func NewClient ¶
NewClient creates a peertube client for the provided peertube server URL.
Example:
cli, err := peertube.NewClient("https://peertube.example.org")
func (*Client) Account ¶
Account returns the account informations for the provided user name on the remote peertube server.
func (*Client) Categories ¶
Categories returns the list of (video) categories on the remote peertube server.
func (*Client) Channels ¶
Channels returns the list of channels for the provided user, on the remote peertube server.
func (*Client) DelVideo ¶
DelVideo deletes the video with the provided id, UUID or ShortUUID.
DelVideo needs the client to be authenticated.
func (*Client) Upload ¶
Upload uploads the provided video to the remote peertube server.
Upload needs the client to be authenticated. Upload uses a resumable protocol to upload the video.
func (*Client) UploadLegacy ¶
UploadLegacy uploads the provided video to the remote peertube server, using a "legacy" protocol.
UploadLegacy needs the client to be authenticated.
func (*Client) UploadResumable ¶
UploadResumable uploads the provided video to the remote peertube server, using a "resumable" protocol.
UploadResumable needs the client to be authenticated.
type Error ¶
type Error struct {
Detail string `json:"detail"`
Docs string `json:"docs"`
Status int `json:"status"`
Title string `json:"title"`
Type string `json:"type"`
}
Error describes errors returned by a remote peertube server.
type PrivacyKind ¶
type PrivacyKind int
PrivacyKind is an enum-like modelization for privacy.
const ( PrivPublic PrivacyKind = 1 PrivUnlisted PrivacyKind = 2 PrivPrivate PrivacyKind = 3 PrivInternal PrivacyKind = 4 PrivPasswordProtected PrivacyKind = 5 )
List of privacy's values and names.
type Video ¶
type Video struct {
ID int `json:"id"`
UUID string `json:"uuid"`
ShortUUID string `json:"shortUUID"`
IsLive bool `json:"isLive"`
Created time.Time `json:"createdAt"`
Updated time.Time `json:"updatedAt"`
Published time.Time `json:"publishedAt"`
OriginallyPublishedAt time.Time `json:"originallyPublishedAt"`
Category Category `json:"category"`
License License `json:"licence"`
Language Language `json:"language"`
Privacy Privacy `json:"privacy"`
Name string `json:"name"`
Description string `json:"description"`
Duration int `json:"duration"`
AspectRatio float64 `json:"aspectRatio"`
IsLocal bool `json:"isLocal"`
ThumbnailPath string `json:"thumbnailPath"`
PreviewPath string `json:"previewPath"`
EmbedPath string `json:"embedPath"`
Views int `json:"views"`
Likes int `json:"likes"`
Dislikes int `json:"dislikes"`
NSFW bool `json:"nsfw"`
WaitTranscoding bool `json:"waitTranscoding"`
DownloadEnabled bool `json:"downloadEnabled"`
StreamingPlaylist []VideoStreamingPlaylist `json:"streamingPlaylists"`
Account Account `json:"account"`
Channel Channel `json:"channel"`
}
Video describes a video on a remote peertube server.
type VideoFile ¶ added in v0.5.0
type VideoFile struct {
ID int `json:"id"`
Width int `json:"width"` // Video stream width
Height int `json:"height"` // Video stream height
Size int `json:"size"` // Video file size in bytes
FPS int `json:"fps"` // Frames per second of the video file
Resolution VideoResolution `json:"resolution"`
MetadataURL string `json:"metadataUrl"` // URL dereferencing the output of ffprobe on the file
TorrentURL string `json:"torrentUrl"` // Direct URL of the torrent file
TorrentDownloadURL string `json:"torrentDownloadUrl"` // URL endpoint that transfers the torrent file as an attachment (so that the browser opens a download dialog)
MagnetURI string `json:"magnetUri"` // magnet URI allowing to resolve the video via BitTorrent without a metainfo file
FileURL string `json:"fileUrl"` // Direct URL of the video
FileDownloadURL string `json:"fileDownloadUrl"` // URL endpoint that transfers the video file as an attachment (so that the browser opens a download dialog)
HasAudio bool `json:"hasAudio"` // The file container has an audio stream
HasVideo bool `json:"hasVideo"` // The file container has a video stream
Storage int `json:"storage"` // File storage
}
VideoFile holds file-level informations about a stored video.
type VideoResolution ¶ added in v0.5.0
VideoResolution describes the resolution of a file ("240p", "480p", ...)
For an audio-only file, the label is usually "Audio only", with a zero ID.
type VideoStreamingPlaylist ¶ added in v0.5.0
type VideoStreamingPlaylist struct {
ID int `json:"id"`
Type int `json:"type"`
PlaylistURL string `json:"playlistUrl"`
SegmentsSha256URL string `json:"segmentsSha256Url"`
Files []VideoFile `json:"files"`
}
VideoStreamingPlaylist represents a HLS playlists/manifest files.
type VideoUpload ¶
type VideoUpload struct {
ChannelID int `json:"channelId"`
Name string `json:"name"`
File File `json:"videofile"`
Category int `json:"category"`
CommentsEnabled bool `json:"commentsEnabled"`
DownloadEnabled bool `json:"downloadEnabled"`
Description string `json:"description"`
Language string `json:"language"`
License int `json:"licence"`
NSFW bool `json:"nsfw"`
OriginallyPublishedAt time.Time `json:"originallyPublishedAt"`
PreviewFile File `json:"previewfile"`
Privacy PrivacyKind `json:"privacy"`
ScheduleUpdate struct {
UpdateAt time.Time `json:"updateAt"`
Privacy PrivacyKind `json:"privacy"`
} `json:"scheduleUpdate"`
Support string `json:"support"`
Tags []string `json:"tags"`
ThumbnailFile File `json:"thumbnailfile"`
VideoPasswords []string `json:"videoPasswords"`
WaitTranscoding bool `json:"waitTranscoding"`
}
VideoUpload describes data and metadata about a video before upload to a remote peertube server.
func NewVideoUpload ¶
func NewVideoUpload(chanID int, name, fname string) (VideoUpload, error)
NewVideoUpload creates a video upload parameter set. NewVideoUpload configures for a video upload to the provided channel ID, with the provided video name and path to video file.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
peertube-cli
command
Command peertube-cli communicates with a PeerTube instance using its REST API.
|
Command peertube-cli communicates with a PeerTube instance using its REST API. |
|
internal
|
|