utils

package
v0.0.0-...-7714c63 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2022 License: MIT Imports: 11 Imported by: 0

README

Utils

Table of contents

Constants

Location of the download directory.

const Folder string

Lists all the colors used in the application.

const (
	ColorReset  string
	ColorRed    string
	ColorGreen  string
	ColorYellow string
	ColorBlue   string
	ColorPurple string
	ColorCyan   string
	ColorGray   string
	ColorWhite  string
)

List of metadatas used in the application.

const (
	MetadataName  string
	MetadataUsage string
)

List of the name and link of the platform used in this application.

const (
	PlatformName  string
	PlatformURL   string
)

List of recurring errors used in this application.

const (
	ErrorPlatformInvalid string
	ErrorArgumentsEmpty  string
)

Functions

Function that allows you to create a folder.

func CreateFolder(url string) string

Function that allows you to convert multiple images into a single PDF.

func ConvertToPdf(name string, number string)

Function that allows you to download documents online.

func DownloadFile(url string, name string, number string)

Function that allows you to retrieve all the content of an HTML page.

func GetContent(url string) string

Function that allows you to recover files from links.

func GetFile(url string, dir string) error

Function that allows you to list all the image links present in an HTML document.

func GetLinks(content string) []string

Function that allows you to list all the files in a folder.

func ListFiles(dir string) []fs.Fileinfo

Function that allows you to display many messages, such as errors, etc.

func Message(str string, level string)

Function that allows you to delete a file.

func RemoveFile(dir string, name string)

Documentation

Index

Constants

View Source
const (
	ColorReset  string = "\033[0m"
	ColorRed    string = "\033[31m"
	ColorGreen  string = "\033[32m"
	ColorYellow string = "\033[33m"
	ColorBlue   string = "\033[34m"
	ColorPurple string = "\033[35m"
	ColorCyan   string = "\033[36m"
	ColorGray   string = "\033[37m"
	ColorWhite  string = "\033[97m"
)

Colors ... Lists all the colors used in the application.

View Source
const (
	MetadataName        string = "Oh My Scan"
	MetadataUsage       string = "Download locally your favorite french manga scans."
	MetadataDownload    string = "Download your favorite manga from scan-op.cc."
	MetadataMerge       string = "Merge uploaded images into a single PDF file."
	MetadataFlagsName   string = "Enter the name of the desired manga."
	MetadataFlagsNumber string = "Enter the volume number of the desired manga."
	MetadataFlagsMerge  string = "Merge directly the manga you just downloaded."
)

Metadata ... List of metadatas used in the application.

View Source
const (
	PlatformName string = "scan-op"
	PlatformURL  string = "https://scan-op.cc/manga/"
)

Platforms ... List of the name and link of the platform used in this application.

View Source
const (
	ErrorArgumentsEmpty string = "You need to specify the the manga's name and the volume's number."
)

Errors ... List of recurring errors used in this application.

View Source
const Folder string = "downloads/"

Folder ... Location of the download directory.

Variables

This section is empty.

Functions

func ConvertToPDF

func ConvertToPDF(name string, number string)

ConvertToPDF ... Function that allows you to convert multiple images into a single PDF.

  • name(string): Name of the manga to convert.
  • number(string): Volume number to convert.

func CreateFolder

func CreateFolder(url string) string

CreateFolder ... Function that allows you to create a folder.

  • name(string): Name of the folder to be created.

func DownloadFile

func DownloadFile(url string, name string, number string)

DownloadFile ... Function that allows you to download documents online.

  • url(string): URL of the HTML page.
  • name(string): Name of the manga to download.
  • number(string): Volume number to download.

func GetContent

func GetContent(url string) string

GetContent ... Function that allows you to retrieve all the content of an HTML page.

  • url(string): URL of the HTML page.

func GetFile

func GetFile(url string, dir string) error

GetFile ... Function that allows you to recover files from links.

  • url(string): URL of the HTML page.
  • dir(string): Folder where the images will be downloaded.
func GetLinks(content string) []string

GetLinks ... Function that allows you to list all the image links present in an HTML document.

  • content(string): Content of the html page to retrieve image links.

func ListFiles

func ListFiles(dir string) []fs.FileInfo

ListFiles ... Function that allows you to list all the files in a folder.

  • dir(string): Name of the folder to list.

func Message

func Message(str string, level string)

Message ... Function that allows you to display many messages, such as errors, etc.

  • str(string): Content of the message.
  • level(string): Alert level of the message.

func RemoveFile

func RemoveFile(dir string, name string)

RemoveFile ... Function that allows you to delete a file.

  • dir(string): Name of the folder where the files to be deleted are located.
  • name(string): Name of the file to be deleted.

Types

This section is empty.

Jump to

Keyboard shortcuts

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