storage

package
v0.0.0-...-9dc5689 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Possible statuses for the media item
	StatusPending     Status = "Pending"
	StatusScraped     Status = "Scraped"
	StatusExtracting  Status = "Extracting"
	StatusDownloading Status = "Downloading"
	StatusDownloaded  Status = "Downloaded"
	StatusError       Status = "Error"

	Quality4K  Quality = "4K"
	QualityFHD Quality = "FHD"
	QualityHD  Quality = "HD"
	QualitySD  Quality = "SD"

	EncodingXVID Encoding = "XviD"
	Encodingx264 Encoding = "x264"
	Encodingx265 Encoding = "x265"
	EncodingVC1  Encoding = "VC-1"
)
View Source
const ISO8601 string = "2006-01-02 03:04:05.000"

Variables

This section is empty.

Functions

func NewCouchDatabase

func NewCouchDatabase(filename string) (*sql.DB, error)

Types

type Download

type Download struct {
	// Remote is the location where the original file resides (ex. URL)
	Remote string
	// Local is the location where the file will be downloaded
	Local string
	// Item is the metadata about the downloaded file
	Item media.SearchItem
}

A Download stores the remote and local locations of a file

type Encoding

type Encoding string

type Magnet

type Magnet struct {
	Location string
	Quality  Quality
	Encoding Encoding
	Item     media.SearchItem
	Size     uint64 // Size in bytes
	Rating   int
	Seeders  int
}

type Media

type Media struct {
	Item media.SearchItem

	CreatedAt time.Time
	UpdatedAt time.Time
	Status    Status
}

Media is the model used for storing the item's information

type MediaRepository

type MediaRepository struct {
	// contains filtered or unexported fields
}

func NewMediaRepository

func NewMediaRepository(db *sql.DB) *MediaRepository

func (*MediaRepository) AddDownload

func (r *MediaRepository) AddDownload(download Download) error

func (*MediaRepository) AddTorrent

func (r *MediaRepository) AddTorrent(t Magnet) error

func (*MediaRepository) Delete

func (r *MediaRepository) Delete(title string) error

func (*MediaRepository) Fetch

func (r *MediaRepository) Fetch(title string) (m Media, err error)

func (*MediaRepository) GetAvailableMagnet

func (r *MediaRepository) GetAvailableMagnet(title string) (m string, err error)

func (*MediaRepository) InProgressDownloads

func (r *MediaRepository) InProgressDownloads() (downloads []Download, err error)

func (*MediaRepository) ItemByLocation

func (r *MediaRepository) ItemByLocation(path string) (m media.SearchItem, err error)

func (*MediaRepository) NonExtractedTorrents

func (r *MediaRepository) NonExtractedTorrents() (torrents []Magnet, err error)

func (*MediaRepository) Status

func (r *MediaRepository) Status(title string, status Status) error

func (*MediaRepository) StoreItem

func (r *MediaRepository) StoreItem(item media.SearchItem) error

func (*MediaRepository) UpdateDownload

func (r *MediaRepository) UpdateDownload(term, url string, isDone bool, err error) error

type Quality

type Quality string

Quality is the quality of the media

type Status

type Status string

Status is the current status of the item

Jump to

Keyboard shortcuts

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