goflix

package module
v0.0.0-...-57789c7 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

README

goflix

-- import "github.com/autom8ter/goflix"

Cli Usage

go get github.com/autom8ter/goflix/cmd/goflix

  _____     _______     
 / ___/__  / __/ (_)_ __
/ (_ / _ \/ _// / /\ \ /
\___/\___/_/ /_/_//_\_\

Usage:
  goflix [command]

Available Commands:
  help        Help about any command
  play        Open stream in video player
  serve       start goflix server

Flags:
  -h, --help   help for goflix

Use "goflix [command] --help" for more information about a command.

Usage

type ClientConfig
type ClientConfig struct {
	TorrentPath    string
	Port           int
	TorrentPort    int
	Seed           bool
	TCP            bool
	MaxConnections int
}

ClientConfig specifies the behaviour of a GoFlix.

func DefaultClientConfig
func DefaultClientConfig() ClientConfig
type ClientError
type ClientError struct {
	Type   string
	Origin error
}

ClientError formats errors coming from the GoFlix.

func (ClientError) Error
func (clientError ClientError) Error() string
type GoFlix
type GoFlix struct {
	Client   *torrent.Client
	Torrent  *torrent.Torrent
	Progress int64
	Uploaded int64
	Config   *ClientConfig
}

GoFlix manages the torrent downloading.

func New
func New(cfg *ClientConfig) (*GoFlix, error)

NewClient creates a new torrent GoFlix based on a magnet or a torrent file. If the torrent file is on http, we try downloading it.

func (*GoFlix) Close
func (c *GoFlix) Close()

Close cleans up the connections.

func (*GoFlix) FileReader
func (c *GoFlix) FileReader() (io.ReadSeeker, error)
func (*GoFlix) GetLargestFile
func (c *GoFlix) GetLargestFile() *torrent.File
func (*GoFlix) HandlerFunc
func (c *GoFlix) HandlerFunc() http.HandlerFunc

GetFile is an http handler to serve the biggest file managed by the GoFlix.

func (*GoFlix) Percentage
func (c *GoFlix) Percentage() float64
func (*GoFlix) ReadyForPlayback
func (c *GoFlix) ReadyForPlayback() bool

ReadyForPlayback checks if the torrent is ready for playback or not. We wait until 5% of the torrent to start playing.

func (*GoFlix) Render
func (c *GoFlix) Render()

Render outputs the command line interface for the GoFlix.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConfig

type ClientConfig struct {
	TorrentPath    string
	Port           int
	TorrentPort    int
	Seed           bool
	TCP            bool
	MaxConnections int
}

ClientConfig specifies the behaviour of a GoFlix.

func DefaultClientConfig

func DefaultClientConfig() ClientConfig

type ClientError

type ClientError struct {
	Type   string
	Origin error
}

ClientError formats errors coming from the GoFlix.

func (ClientError) Error

func (clientError ClientError) Error() string

type GoFlix

type GoFlix struct {
	Client   *torrent.Client
	Torrent  *torrent.Torrent
	Progress int64
	Uploaded int64
	Config   *ClientConfig
}

GoFlix manages the torrent downloading.

func New

func New(cfg *ClientConfig) (*GoFlix, error)

NewClient creates a new torrent GoFlix based on a magnet or a torrent file. If the torrent file is on http, we try downloading it.

func (*GoFlix) Close

func (c *GoFlix) Close()

Close cleans up the connections.

func (*GoFlix) FileReader

func (c *GoFlix) FileReader() (io.ReadSeeker, error)

func (*GoFlix) GetLargestFile

func (c *GoFlix) GetLargestFile() *torrent.File

func (*GoFlix) HandlerFunc

func (c *GoFlix) HandlerFunc() http.HandlerFunc

GetFile is an http handler to serve the biggest file managed by the GoFlix.

func (*GoFlix) Percentage

func (c *GoFlix) Percentage() float64

func (*GoFlix) ReadyForPlayback

func (c *GoFlix) ReadyForPlayback() bool

ReadyForPlayback checks if the torrent is ready for playback or not. We wait until 5% of the torrent to start playing.

func (*GoFlix) Render

func (c *GoFlix) Render()

Render outputs the command line interface for the GoFlix.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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