resume

package
v0.1.56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocationDropbox     fileLocation = 0
	LocationGoogleDrive fileLocation = 1
	LocationLocal       fileLocation = 2
)
View Source
const (
	StateUploadInProgress uploaderState = 1
	StateIdle             uploaderState = 2
)
View Source
const (
	StatusDone   responseStatus = 1
	StatusResume responseStatus = 2
	StatusFailed responseStatus = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChunkReader

type ChunkReader struct {
	Reader    io.Reader
	ChunkSize int64
	// contains filtered or unexported fields
}

func NewChunkReader

func NewChunkReader(r io.Reader, chunkSize int64) *ChunkReader

func (*ChunkReader) Read

func (cr *ChunkReader) Read(p []byte) (n int, err error)

type Service

type Service struct {
	State         uploaderState
	Location      fileLocation
	AccessToken   string
	UploadURL     string
	ChunkSize     int64
	StateFile     string
	DriveService  *drive.Service
	DropboxConfig *dropbox.Config
	ContentFile   string
	ContentLength int64
}

func NewDropbox added in v0.1.34

func NewDropbox(dropboxConfig *dropbox.Config, youtubeAccessToken string, chunkSize int64, stateFilePath string) (*Service, error)

func NewGoogleDrive

func NewGoogleDrive(driveService *drive.Service, youtubeAccessToken string, chunkSize int64, stateFilePath string) (*Service, error)

func NewLocalFile

func NewLocalFile(youtubeAccessToken string, chunkSize int64, stateFilePath string) (*Service, error)

func (*Service) Initialise

func (s *Service) Initialise(contentFile string, data *youtube.Video) error

func (*Service) Upload

func (s *Service) Upload(ctx context.Context, progress func(int64)) (*youtube.Video, error)

type State

type State struct {
	UploadUrl     string `json:"upload_url"`
	ContentFile   string `json:"content_file"`
	ContentLength int64  `json:"content_length"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL