Added Makefile
This commit is contained in:
parent
04cdfc21d5
commit
d9b58bbade
3 changed files with 36 additions and 3 deletions
14
Makefile
Normal file
14
Makefile
Normal file
|
@ -0,0 +1,14 @@
|
|||
.PHONY: default debug run
|
||||
|
||||
GIT_COMMIT := $(shell git rev-parse HEAD)
|
||||
BUILD_DATE := $(shell date -u +%Y%m%d.%H%M%S)
|
||||
CGO_ENABLED=0
|
||||
|
||||
default:
|
||||
CGO_ENABLED=$(CGO_ENABLED) go build -o out/ytva -trimpath -ldflags "-s -w -X main.gitCommit=$(GIT_COMMIT) -X main.buildDate=$(BUILD_DATE)" .
|
||||
|
||||
debug:
|
||||
go build -o out/ytva -ldflags "-X main.gitCommit=$(GIT_COMMIT) -X main.buildDate=$(BUILD_DATE)" .
|
||||
|
||||
run:
|
||||
go run .
|
|
@ -2,7 +2,7 @@ TempDir = "/tmp/"
|
|||
|
||||
[Group.PCBuilders]
|
||||
URL = [ "https://www.youtube.com/@BudgetBuildsOfficial", "https://www.youtube.com/@RandomGaminginHD" ]
|
||||
OutputDir = "out/%Channel%/%Playlist%/"
|
||||
OutputDir = "videos/%Channel%/%Playlist%/"
|
||||
FileName = "%Timestamp% - %Title%.mkv"
|
||||
CFormat = "matroska"
|
||||
VideoFormat = "bestvideo[height<=720]"
|
||||
|
@ -12,7 +12,7 @@ SizeLimit = 4294967296
|
|||
|
||||
[Group.Odysee]
|
||||
URL = [ "https://odysee.com/@AlphaNerd:8", "https://odysee.com/@rossmanngroup:a" ]
|
||||
OutputDir = "out2/%Channel%/"
|
||||
OutputDir = "videos2/%Channel%/"
|
||||
FileName = "%Timestamp% - %Title%.mkv"
|
||||
CFormat = "mp4"
|
||||
VideoFormat = "best[height<=720]"
|
||||
|
|
21
ytva.go
21
ytva.go
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
//"flag"
|
||||
"context"
|
||||
//"fmt"
|
||||
"fmt"
|
||||
"os"
|
||||
//"io"
|
||||
//"reflect"
|
||||
|
@ -21,6 +21,7 @@ import (
|
|||
type _flags struct {
|
||||
Quiet bool `arg:"-q,--quiet" help:"Output only warnings and errors."`
|
||||
Verbose bool `arg:"-v,--verbose" help:"Enables debug output."`
|
||||
Version bool `arg:"--version" help:"Prints version of ytva and exits."`
|
||||
ConfigFile string `arg:"-c,--config,env:YTVA_CONFIG" help:"Specifies the path to a TOML formatted configuration file." default:"config.toml"`
|
||||
}
|
||||
|
||||
|
@ -50,6 +51,10 @@ type GroupConfig struct {
|
|||
|
||||
var MainConfig _config
|
||||
|
||||
var gitCommit string
|
||||
var buildDate string
|
||||
|
||||
|
||||
func main() {
|
||||
_ = arg.MustParse(&Flags)
|
||||
|
||||
|
@ -63,6 +68,20 @@ func main() {
|
|||
log.SetLevel(log.WarnLevel)
|
||||
}
|
||||
|
||||
if Flags.Version {
|
||||
if gitCommit == "" {
|
||||
gitCommit = "unknown"
|
||||
}
|
||||
|
||||
if buildDate == "" {
|
||||
buildDate = "unknown"
|
||||
}
|
||||
|
||||
fmt.Printf("Commit %s built on %s\n", gitCommit, buildDate)
|
||||
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
confFile, err := os.ReadFile(Flags.ConfigFile)
|
||||
if(err != nil) {
|
||||
log.Fatal(err)
|
||||
|
|
Loading…
Reference in a new issue