feat: update jobs
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
// ExecCommand executes a command and streams its output in real-time
|
||||
func ExecCommand(name string, args ...string) error {
|
||||
log.Infof("Executing command: %s %v", name, args)
|
||||
cmd := exec.Command(name, args...)
|
||||
|
||||
stdout, err := cmd.StdoutPipe()
|
||||
@@ -58,6 +59,7 @@ func ExecCommand(name string, args ...string) error {
|
||||
|
||||
// ExecCommandOutput executes a command and returns its output
|
||||
func ExecCommandOutput(name string, args ...string) ([]byte, error) {
|
||||
log.Infof("Executing command: %s %v", name, args)
|
||||
cmd := exec.Command(name, args...)
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
|
||||
45
backend/pkg/utils/posts.go
Normal file
45
backend/pkg/utils/posts.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package utils
|
||||
|
||||
import "strings"
|
||||
|
||||
// FormatTitle
|
||||
// Format the title of a media file by replacing spaces with underscores and removing special characters
|
||||
func FormatTitle(title string) string {
|
||||
// remove file ext from title
|
||||
if strings.Contains(title, ".") {
|
||||
title = strings.Split(title, ".")[0]
|
||||
}
|
||||
|
||||
// replace all spaces with underscores
|
||||
replacements := []string{
|
||||
" ", "",
|
||||
"!", "",
|
||||
"@", "",
|
||||
"#", "",
|
||||
"$", "",
|
||||
"%", "",
|
||||
"^", "",
|
||||
"&", "",
|
||||
"*", "",
|
||||
"(", "(",
|
||||
")", ")",
|
||||
"[", "【",
|
||||
"]", "】",
|
||||
"{", "《",
|
||||
"}", "》",
|
||||
":", ":",
|
||||
";", "",
|
||||
"'", "",
|
||||
"\"", "",
|
||||
"<", "",
|
||||
">", "",
|
||||
",", "",
|
||||
".", "",
|
||||
"?", "",
|
||||
}
|
||||
|
||||
replacer := strings.NewReplacer(replacements...)
|
||||
title = replacer.Replace(title)
|
||||
|
||||
return title
|
||||
}
|
||||
Reference in New Issue
Block a user