Compare commits
2 Commits
8ab4b4c280
...
07c20f4582
Author | SHA1 | Date | |
---|---|---|---|
07c20f4582 | |||
9b38ea7068 |
@@ -6,6 +6,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/gen2brain/beeep"
|
||||
@@ -62,8 +63,9 @@ func DownloadR(url string) error {
|
||||
}
|
||||
|
||||
fullVideoPath := filepath.Join(OUTPUT_DIR, videoAuthor, videoTitle+".mp4")
|
||||
_, err = os.Open(fullVideoPath)
|
||||
videoFileHandle, err := os.Open(fullVideoPath)
|
||||
if err == nil {
|
||||
videoFileHandle.Close()
|
||||
log.Printf("File %s already exists, skipping download", fullVideoPath)
|
||||
return nil
|
||||
}
|
||||
@@ -78,11 +80,10 @@ func DownloadR(url string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var re = regexp.MustCompile(`[#!$%&/()";:?;,]`)
|
||||
|
||||
func Sanitize(s string) string {
|
||||
s = strings.ReplaceAll(s, "&", "and")
|
||||
s = strings.ReplaceAll(s, "?", "")
|
||||
s = strings.ReplaceAll(s, ":", "")
|
||||
s = strings.ReplaceAll(s, ";", "")
|
||||
s = strings.ReplaceAll(s, ",", "")
|
||||
s = re.ReplaceAllString(s, "")
|
||||
return s
|
||||
}
|
||||
|
Reference in New Issue
Block a user