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