Compare commits
2 Commits
master
...
setup-fold
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
426e3ce84f
|
||
|
|
a7d770bf28
|
12
devenv.lock
12
devenv.lock
@@ -3,10 +3,10 @@
|
|||||||
"devenv": {
|
"devenv": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "src/modules",
|
"dir": "src/modules",
|
||||||
"lastModified": 1734605856,
|
"lastModified": 1758136890,
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "devenv",
|
"repo": "devenv",
|
||||||
"rev": "f81cf7dc4cbfa46de11618af94e5983c5e600d8c",
|
"rev": "9ed7eb30c3d0d16d3127da7e18562e243a4d6d7d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -40,10 +40,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1750779888,
|
"lastModified": 1758108966,
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "git-hooks.nix",
|
"repo": "git-hooks.nix",
|
||||||
"rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d",
|
"rev": "54df955a695a84cd47d4a43e08e1feaf90b1fd9b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -74,10 +74,10 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733477122,
|
"lastModified": 1755783167,
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "devenv-nixpkgs",
|
"repo": "devenv-nixpkgs",
|
||||||
"rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857",
|
"rev": "4a880fb247d24fbca57269af672e8f78935b0328",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -4,18 +4,12 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"kattudden/newsboat-yt/config"
|
"kattudden/newsboat-yt/config"
|
||||||
"kattudden/newsboat-yt/utils"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
func YoutubeVideo(url string) error {
|
func YoutubeVideo(url string) error {
|
||||||
conf, _ := config.New()
|
conf, _ := config.New()
|
||||||
|
|
||||||
err := utils.EnsureDirectory(conf.DownloadPath)
|
|
||||||
if err != nil {
|
|
||||||
return errors.New("failed to create download directory!")
|
|
||||||
}
|
|
||||||
|
|
||||||
downloadBinary := "yt-dlp"
|
downloadBinary := "yt-dlp"
|
||||||
|
|
||||||
output := fmt.Sprintf("%s/%%(title)s.%%(ext)s", conf.DownloadPath)
|
output := fmt.Sprintf("%s/%%(title)s.%%(ext)s", conf.DownloadPath)
|
||||||
@@ -24,7 +18,7 @@ func YoutubeVideo(url string) error {
|
|||||||
|
|
||||||
fmt.Println(cmd.String())
|
fmt.Println(cmd.String())
|
||||||
|
|
||||||
err = cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return errors.New("failed to download video!")
|
return errors.New("failed to download video!")
|
||||||
|
|||||||
15
main.go
15
main.go
@@ -3,8 +3,10 @@ package main
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"kattudden/newsboat-yt/config"
|
||||||
"kattudden/newsboat-yt/database"
|
"kattudden/newsboat-yt/database"
|
||||||
"kattudden/newsboat-yt/download"
|
"kattudden/newsboat-yt/download"
|
||||||
|
"kattudden/newsboat-yt/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -14,6 +16,19 @@ func main() {
|
|||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
conf, _ := config.New()
|
||||||
|
err := utils.EnsureDirectory(conf.DownloadPath)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("failed to create download directory!")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err = utils.EnsureDirectory(conf.DatabaseDirectory)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("failed to create database directory!")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if *newUrl != "" {
|
if *newUrl != "" {
|
||||||
fmt.Println("Adding new URL.")
|
fmt.Println("Adding new URL.")
|
||||||
database.InsertUrl(*newUrl)
|
database.InsertUrl(*newUrl)
|
||||||
|
|||||||
Reference in New Issue
Block a user