Documentation ¶
Index ¶
- Constants
- Variables
- func CollectLectures(config *Config) (lectures [][]Lecture, err error)
- func FindConfig(paths []string) (path string, err error)
- func GetEnv(variable string) string
- func ProgressBarConfig(bar *pb.ProgressBar, prefix string)
- func ReplaceSpaceWithChar(str string, char string) string
- func StripTrailingSlash(str string) string
- type Collector
- type CollyConfigs
- type Config
- type Download
- type Lecture
- type LectureType
- type LecturesService
- type ProgressBar
- type Query
- type Result
Constants ¶
const ( // Version defines a version Version = "0.2.0" // SmalAuthor holds the copyright holder SmalAuthor = "(c) 2020 - present Birger J. Nordølum" // ConfigName defines the default filename for the configuration ConfigName = "smal.toml" // MaxConcurrentDownloads number of concurrent downloads MaxConcurrentDownloads = 3 // Banner is our small logo Banner = "\n" + " _______. .___ ___. ___ __ \n" + " / | | \\/ | / \\ | | \n" + " | (----` ______| \\ / | ______ / ^ \\ ______| | \n " + " \\ \\ |______| |\\/| | |______/ /_\\ \\ |______| | \n" + ".----) | | | | | / _____ \\ | `----. \n" + "|_______/ |__| |__| /__/ \\__\\ |_______| \n" )
Variables ¶
var ConfigLocations = []string{ strings.Join([]string{GetEnv("XDG_CONFIG_HOME"), "smal"}, "/"), GetEnv("XDG_CONFIG_HOME"), ".", }
ConfigLocations to potential config locations to check
var VerboseOption bool
VerboseOption tells if we've enabled verbose via the cli
Functions ¶
func CollectLectures ¶ added in v0.2.0
CollectLectures get all the subjects given by the map.
func FindConfig ¶ added in v0.0.2
FindConfig checks to see if a path contains a file named ConfigName Takes a string slice of arrays Returns path/ConfigName if the file exist
func GetEnv ¶ added in v0.0.2
GetEnv returns the contents of an environment variable Takes variable name as a string Returns the content of the variable if it is set,
otherwise returns an empty string
func ProgressBarConfig ¶ added in v0.2.0
func ProgressBarConfig(bar *pb.ProgressBar, prefix string)
ProgressBarConfig hold the ProgressBar configuration
func ReplaceSpaceWithChar ¶ added in v0.2.0
ReplaceSpaceWithChar looks for a space and replaces it with a character of choice.
func StripTrailingSlash ¶ added in v0.0.2
StripTrailingSlash removes the trailing forward slash
Types ¶
type Collector ¶ added in v0.0.2
type Collector struct { Lecturer string Subject string Count int // contains filtered or unexported fields }
Collector defines a new collector for storting both the colly.Collector as well as other options.
func NewCollector ¶ added in v0.0.2
NewCollector inilialize a new collector for each subject.
func (*Collector) GetLectures ¶ added in v0.0.2
GetLectures retrieves lectures.
type CollyConfigs ¶ added in v0.2.0
type CollyConfigs struct{}
CollyConfigs is a collection of availableflags for colly Maybe implement as a function. Look at official docs.
type Config ¶ added in v0.0.2
Config contains variables used for configuration. Member data are set as private to avoid changing them at runtime.
func (*Config) GetDebug ¶ added in v0.0.2
GetDebug returns whether the config has enable debug support
func (*Config) ReadConfig ¶ added in v0.2.0
ReadConfig parses config files and overwrite existing data Takes path to a toml file and parses it's content Returns an error if anything fails.
type Lecture ¶
type Lecture struct { ID string Tidspunkt time.Time Varighet int Foreleser string Tittel string Emne string URL map[string]string Info string }
Lecture inneholder all metadata om en forelesning.
func (*Lecture) CapturedToday ¶ added in v0.2.0
CapturedToday return whether the lecture were captured today.
func (*Lecture) DeserializeElapsedTime ¶ added in v0.0.2
DeserializeElapsedTime converts the string "number min" to number
type LectureType ¶
type LectureType int
LectureType is the generic type for lecture formats.
const ( Audio LectureType = iota // Audio only Camera LectureType = iota // Camera only Combined LectureType = iota // Both camera & screen Screen LectureType = iota // Only screen DateLayout = "2006-01-02 15:04" // Date format from site )
Contains the enum types for possible lecture type
type LecturesService ¶ added in v0.0.2
type LecturesService struct {
// contains filtered or unexported fields
}
LecturesService contains the collector.
type ProgressBar ¶ added in v0.2.0
type ProgressBar struct {
// contains filtered or unexported fields
}
ProgressBar wraps a github.com/cheggaaa/pb.Pool in order to display download progress for one or multiple downloads.
If two different instance of ProgressBar try to display a progress only one will be displayed. It is therefore recommended to use DefaultProgressBar
func (*ProgressBar) TrackProgress ¶ added in v0.2.0
func (cpb *ProgressBar) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser
TrackProgress instantiates a new progress bar that will display the progress of stream until closed. total can be 0.