fs

package
v0.0.0-...-f0b9b21 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExtensionImage is the format images are going to be saved as
	ExtensionImage string = ".jpg"
	// ExtensionVideo is the format videos are going to be saved as
	ExtensionVideo string = ".mp4"

	// ThumbnailDir defines the sub-dir used to store thumbnails.
	ThumbnailDir string = "thumbnail"
	// PosterDir defines the sub-dir used to store posters.
	PosterDir string = "poster"
	// BannerDir defines the sub-dir used to store banners.
	BannerDir string = "banner"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSystem

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

FileSystem is made up of methods will help us have better Input/Output control over out anime/images.

func NewFileSystem

func NewFileSystem(c configmodels.Directories) (fs *FileSystem)

NewFileSystem creates a new instance of the filesystem with the provided configuration, while initializing the patternizer.

func (FileSystem) Close

func (fs FileSystem) Close() error

Close removes the `temporary_downloads` path along with it's contents.

func (FileSystem) CreateAnime

func (f FileSystem) CreateAnime(anime domain.AnimeBase) (*os.File, error)

CreateAnime creates a file based on the created anime and it's base/parent dir is ensured that it's created.

func (FileSystem) CreateBannerImage

func (fs FileSystem) CreateBannerImage(reader io.Reader) (string, error)

func (FileSystem) CreatePathAnime

func (fs FileSystem) CreatePathAnime(anime domain.AnimeBase) string

func (FileSystem) CreatePosterImage

func (fs FileSystem) CreatePosterImage(reader io.Reader) (string, error)

func (FileSystem) CreateTempAnime

func (fs FileSystem) CreateTempAnime(anime domain.AnimeBase) (*os.File, error)

func (FileSystem) CreateTempImage

func (fs FileSystem) CreateTempImage() (*os.File, error)

func (FileSystem) CreateThumbnailImage

func (fs FileSystem) CreateThumbnailImage(reader io.Reader) (string, error)

func (FileSystem) DeleteAnime

func (fs FileSystem) DeleteAnime(anime domain.AnimeBase) (err error)

DeleteAnime will delete an anime. It won't throw an execption if it doesn't exist.

func (FileSystem) DeleteBannerImage

func (fs FileSystem) DeleteBannerImage(filename string) error

func (FileSystem) DeletePosterImage

func (fs FileSystem) DeletePosterImage(filename string) error

func (FileSystem) DeleteThumbnailImage

func (fs FileSystem) DeleteThumbnailImage(filename string) error

func (FileSystem) EnsureDirectories

func (fs FileSystem) EnsureDirectories() (err error)

EnsureDirectories ensures that all directories within the config.Paths are created.

func (FileSystem) GetAnime

func (fs FileSystem) GetAnime(anime domain.AnimeBase) (io.ReadCloser, error)

func (FileSystem) GetBannerImages

func (fs FileSystem) GetBannerImages() ([]fs.DirEntry, error)

func (FileSystem) GetBannerPath

func (fs FileSystem) GetBannerPath() string

GetBannerPath returns the banners path

func (FileSystem) GetDownloadsPath

func (fs FileSystem) GetDownloadsPath() string

GetDownloadsPath returns the downloads path

func (FileSystem) GetImagesPath

func (fs FileSystem) GetImagesPath() string

GetImagesPath returns the images path.

func (FileSystem) GetPosterImages

func (fs FileSystem) GetPosterImages() ([]fs.DirEntry, error)

func (FileSystem) GetPosterPath

func (fs FileSystem) GetPosterPath() string

GetPosterPath returns the posters path

func (FileSystem) GetTemporaryDownloadsPath

func (fs FileSystem) GetTemporaryDownloadsPath() string

GetTemporaryDownloadsPath returns the temporary downloads path

func (FileSystem) GetThumbnailImages

func (fs FileSystem) GetThumbnailImages() ([]fs.DirEntry, error)

func (FileSystem) GetThumbnailPath

func (fs FileSystem) GetThumbnailPath() string

GetThumbnailPath returns the thumbnails path

func (FileSystem) HasAnime

func (fs FileSystem) HasAnime(anime domain.AnimeBase) bool

func (FileSystem) HasBannerImage

func (fs FileSystem) HasBannerImage(hash string) bool

func (FileSystem) HasPosterImage

func (fs FileSystem) HasPosterImage(hash string) bool

func (FileSystem) HasThumbnailImage

func (fs FileSystem) HasThumbnailImage(hash string) bool

func (FileSystem) L

func (f FileSystem) L() *zap.Logger

L returns a named logger for this module

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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