common

package
v0.0.0-...-406ac44 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Copyright © 2018 Patrick Nuckolls <nuckollsp at gmail>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	Linux   OS   = "linux"
	Windows OS   = "windows"
	OSx     OS   = "darwin"
	Amd64   Arch = "amd64"
	I386    Arch = "386"
)

Any additional architectures/OS's need to be added here

View Source
const BuildType = "unix"

Variables

View Source
var (
	AlwaysPanic bool
)

Functions

func CowardlyCreateDir

func CowardlyCreateDir(dirname string) error

Will ask for user confirmation for creating folders outside SettingsDir, or to create SettingsDir. Otherwise will error out

func ForceSuperuser

func ForceSuperuser(value bool)

func GetDefaultSettingsDir

func GetDefaultSettingsDir() string

Returns full path to the default settings directory location ~/.local/share/transcodebot on unix's if normal user

func IsSuperUser

func IsSuperUser() bool

func MaybePanic

func MaybePanic(err error)

Procedure:

MaybePanic

Purpose:

To panic if an error appears
Really exists to help with debugging

Parameters:

the error: err

Produces:

Side effects:
  panic
Or nothing

Preconditions:

No additional

Postconditions:

panic if AlwaysPanic

func PrintError

func PrintError(in ...interface{})

func PrintVerbose

func PrintVerbose(in ...interface{})

Print only if appropriate for verbosity

func Println

func Println(in ...interface{})

func SetSettingsDir

func SetSettingsDir(settingsDirIn string)

Sets internal settings directory. Will panic if called more than once.

func SettingsDir

func SettingsDir(relPath ...string) string

Procedure:

SettingsDir

Purpose:

To safely return an absolute path under SettingsDir()

Parameters:

Additional path elements: relPath ...string

Produces:

output string

Preconditions:

SetSettingsDir has been called

Postconditions:

output = $settingsDir/$relPath/$relPath/$relPath...

func SettingsWriteFile

func SettingsWriteFile(data []byte, relPath ...string) error

Safely write data bytes to a file inside the settings directory.

Types

type Arch

type Arch string

Operating system system architecture Should be limited to those that Go can target

func (Arch) ToString

func (system Arch) ToString() string

type Computer

type Computer struct {
	Processors  int
	DiskSpaceMb int
}

type OS

type OS string

Operating system name type Should be limited to those that Go can target

func (OS) ToString

func (system OS) ToString() string

type SystemType

type SystemType struct {
	OS   OS
	Arch Arch
}

Basic system information

func (SystemType) ToString

func (system SystemType) ToString() string

type TranscodeSettings

type TranscodeSettings struct {
	//Optionally short-circuit all of the built in logic and specify the command manually, and ignore all other options.
	//Pseudocode of what happens if this option is not zero-length:
	//for line in RawffmpegOptions:
	//	Sys.Execute("ffmpeg -nostdin -i $inputfile $line")
	RawffmpegOptions []string

	//If false, error if a stream is found that cannot be converted
	HandleUnuseableStreams bool
	//If true and HandleUnuseableStreams is true, throw out streams that can't be converted to a target type
	//If false, pass through the stream to the output unmolested
	TossUnuseableStreams bool
	//The containing file type, i.e. webm, mkv, mp4, mov
	ContainerType string

	//Video Codec to use
	VideoCodec string
	//Subpixel format
	PixFormat string
	//Speed parameter for the primary (second in two pass) encoding pass
	PrimaryPassSpeed uint8
	//Whether to do two-pass encoding
	TwoPass bool
	//Speed parameter for the log (first and possibly omitted) pass
	PreliminaryPassSpeed uint8

	//Audio codec to use
	AudioCodec string

	//Subtitle codec to use
	SubtitleCodec string
}

Settings to pass to ffmpeg to use for transcoding Most of these settings line up with something in the ffmeg documentation, and

Jump to

Keyboard shortcuts

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